plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

Please take a moment to read the platform’s guidelines before you get started!


Idea

tml avatar image
tml suggested tml edited

Please run templates and other XML files through XML syntax check before shipping

It would catch many errors and just makes sense.

Sure, the use of element tags with '#' characters in them (for template arguments) is already enough to make the files formally invalid XML, but that detail can be trivially bypassed by a preprocessing stage before checking each file.

Here is the patch I had to apply to make the template files included by the DA62 interior model XML load without errors into Python:

diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Aircraft.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Aircraft.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Aircraft.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Aircraft.xml2021-11-27 00:34:25.000000000 +0200
@@ -25,7 +25,7 @@
 </Parameters>
 <Condition NotEmpty="NODE_ID_HANDLE">
 <UseTemplate Name="ASOBO_AIRCRAFT_Door_Open_Close_Template">
-<NODE_ID>#NODE_ID_HANDLE#</#NODE_ID>
+<NODE_ID>#NODE_ID_HANDLE#</NODE_ID>
 </UseTemplate>
 </Condition>
 </Template>
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Autopilot_Subtemplates.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Autopilot_Subtemplates.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Autopilot_Subtemplates.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Autopilot_Subtemplates.xml2021-11-27 00:34:49.000000000 +0200
@@ -938,7 +938,7 @@
 </False>
 </Condition>
 </Condition>
-</Condition>
+</Parameters>
 <Parameters Type="Default">
 <INPUT_EVENT_ID_SOURCE>AUTOPILOT</INPUT_EVENT_ID_SOURCE>
 <NODE_ID>AUTOPILOT_Knob_Baro_#ID##SUFFIX_ID#</NODE_ID>
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Deice_Subtemplates.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Deice_Subtemplates.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Deice_Subtemplates.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Deice_Subtemplates.xml2021-11-27 00:35:32.000000000 +0200
@@ -440,9 +440,9 @@
 </Switch>
 <Switch Param="TYPE">
 <Case Value="NORM_OFF_HIGH">
-<POS_NORM>0</NORM>
-<POS_OFF>1</OFF>
-<POS_HIGH>2</HIGH>
+<POS_NORM>0</POS_NORM>
+<POS_OFF>1</POS_OFF>
+<POS_HIGH>2</POS_HIGH>
 </Case>
 <Case Value="AS04F">
 <POS_ICE>0</POS_ICE>
@@ -652,7 +652,7 @@
 <Switch param="INTERACTION_TYPE">
 <Case Value="PUSH">
 <SEQ1_EMISSIVE_CODE>(B:DEICE_Pitot_#ID#)</SEQ1_EMISSIVE_CODE>
-<SEQ2_EMISSIVE_CODE>(B:DEICE_Pitot_#ID#) !</SEQ_EMISSIVE_CODE>
+<SEQ2_EMISSIVE_CODE>(B:DEICE_Pitot_#ID#) !</SEQ2_EMISSIVE_CODE>
 </Case>
 <Case Value="SWITCH">
 <ANIM_CODE>(B:DEICE_Pitot_#ID#) 100 *</ANIM_CODE>
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Engine_Subtemplates.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Engine_Subtemplates.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Engine_Subtemplates.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Engine_Subtemplates.xml2021-11-27 00:36:51.000000000 +0200
@@ -2069,7 +2069,7 @@
 <ANIM_CODE>(#DRAG_ANIMATION_VARIABLE_TYPE#:#DRAG_ANIMATION_VARIABLE_NAME#)</ANIM_CODE>
 </UseTemplate>
 <Update Frequency="1">
-(* This update forces the PROP & MIXTURE Levers to specific values, which may conflict with the AutoStart, so only run it while the autostart is disabled, using the fuel trigger which is linked to the autostart *)
+(* This update forces the PROP &amp; MIXTURE Levers to specific values, which may conflict with the AutoStart, so only run it while the autostart is disabled, using the fuel trigger which is linked to the autostart *)
 (A:FUELSYSTEM TRIGGER STATUS:1, Bool) ! if{
 (A:GENERAL ENG MIXTURE LEVER POSITION:#ID#, percent over 100) 0.01 &lt; if{
 (#POSITION_TYPE#:#POSITION_VAR#) 1 &gt;= if{
@@ -2371,7 +2371,7 @@
 }
 }
 </UPDATE_CODE>
-</Update>
+</UseTemplate>
 </Component>
 </Condition>
 </Default>
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Fuel_Subtemplates.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Fuel_Subtemplates.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Fuel_Subtemplates.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Fuel_Subtemplates.xml2021-11-27 00:40:01.000000000 +0200
@@ -856,7 +856,7 @@
 </Setup>
 <Do>
 <Parameters Type="Override" Lifetime="Loop">
-<SELECTOR_STATE_COUNT_T Process="Int">#SELECTOR_STATE_COUNT_T# 1 +</SELECTOR_STATE_COUNT>
+<SELECTOR_STATE_COUNT Process="Int">#SELECTOR_STATE_COUNT_T# 1 +</SELECTOR_STATE_COUNT>
 </Parameters>
 <Parameters Type="Override" Lifetime="Iteration">
 <ID_POS Process="Param">SELECTOR_STATE_#SEL_ID#</ID_POS>
@@ -1431,7 +1431,7 @@
 <Parameters Type="Override">
 <SET_STATE_#POS_CUT_OFF#>0 (&gt;#CUTOFF_VAR#) 0 (&gt;K:SET_FUEL_VALVE_ENG#ID#) 0 (&gt;A:TURB ENG CONDITION LEVER POSITION:#ID#,enum)</SET_STATE_#POS_CUT_OFF#>
 <STR_STATE_#POS_HI_IDLE#>High_Idle</STR_STATE_#POS_HI_IDLE#>
-<STR_STATE_#POS_LO_IDLE#>Low_Idle</POS_LO_IDLE#POS_OFF#>
+<STR_STATE_#POS_LO_IDLE#>Low_Idle</STR_STATE_#POS_LO_IDLE#>
 <STR_STATE_#POS_CUT_OFF#>Cut_Off</STR_STATE_#POS_CUT_OFF#>
 
 <NO_ANIM_VAR_UPDATE>False</NO_ANIM_VAR_UPDATE>
@@ -1482,19 +1482,19 @@
 <BINDING_INC_1_EVENT_ID>MIXTURE_DECR_SMALL</BINDING_INC_1_EVENT_ID>
 <BINDING_INC_1_EVENT_ID_ONLY>True</BINDING_INC_1_EVENT_ID_ONLY>
 <BINDING_INC_2>Mixture_Decr#SUFFIX_ID#</BINDING_INC_2>
-<BINDING_INC_2_PARAM_0>1</BINDING_INC_0_PARAM_2>
+<BINDING_INC_2_PARAM_0>1</BINDING_INC_2_PARAM_0>
 <BINDING_INC_2_EVENT_ID>MIXTURE#ID#_DECR</BINDING_INC_2_EVENT_ID>
 <BINDING_INC_2_EVENT_ID_ONLY>True</BINDING_INC_2_EVENT_ID_ONLY>
 <BINDING_INC_3>CONDITION_LEVER_DEC</BINDING_INC_3>
-<BINDING_INC_3_PARAM_0>1</BINDING_INC_0_PARAM_3>
+<BINDING_INC_3_PARAM_0>1</BINDING_INC_3_PARAM_0>
 <BINDING_INC_3_EVENT_ID>CONDITION_LEVER_DEC</BINDING_INC_3_EVENT_ID>
 <BINDING_INC_3_EVENT_ID_ONLY>True</BINDING_INC_3_EVENT_ID_ONLY>
 <BINDING_INC_4>CONDITION_LEVER#SUFFIX_ID#_DEC</BINDING_INC_4>
-<BINDING_INC_4_PARAM_0>1</BINDING_INC_0_PARAM_4>
+<BINDING_INC_4_PARAM_0>1</BINDING_INC_4_PARAM_0>
 <BINDING_INC_4_EVENT_ID>CONDITION_LEVER#SUFFIX_ID#_DEC</BINDING_INC_4_EVENT_ID>
 <BINDING_INC_4_EVENT_ID_ONLY>True</BINDING_INC_4_EVENT_ID_ONLY>
 <BINDING_INC_5>Mixture_Decr#SUFFIX_ID#_Small</BINDING_INC_5>
-<BINDING_INC_5_PARAM_0>1</BINDING_INC_0_PARAM_5>
+<BINDING_INC_5_PARAM_0>1</BINDING_INC_5_PARAM_0>
 <BINDING_INC_5_EVENT_ID>MIXTURE#ID#_DECR_SMALL</BINDING_INC_5_EVENT_ID>
 <BINDING_INC_5_EVENT_ID_ONLY>True</BINDING_INC_5_EVENT_ID_ONLY>
 
@@ -1512,15 +1512,15 @@
 <BINDING_DEC_2_EVENT_ID_ONLY>True</BINDING_DEC_2_EVENT_ID_ONLY>
 <BINDING_DEC_2_PARAM_0>1</BINDING_DEC_2_PARAM_0>
 <BINDING_DEC_3>CONDITION_LEVER_INC</BINDING_DEC_3>
-<BINDING_DEC_3_PARAM_0>1</BINDING_DEC_0_PARAM_3>
+<BINDING_DEC_3_PARAM_0>1</BINDING_DEC_3_PARAM_0>
 <BINDING_DEC_3_EVENT_ID>CONDITION_LEVER_INC</BINDING_DEC_3_EVENT_ID>
 <BINDING_DEC_3_EVENT_ID_ONLY>True</BINDING_DEC_3_EVENT_ID_ONLY>
 <BINDING_DEC_4>CONDITION_LEVER#SUFFIX_ID#_INC</BINDING_DEC_4>
-<BINDING_DEC_4_PARAM_0>1</BINDING_DEC_0_PARAM_4>
+<BINDING_DEC_4_PARAM_0>1</BINDING_DEC_4_PARAM_0>
 <BINDING_DEC_4_EVENT_ID>CONDITION_LEVER#SUFFIX_ID#_INC</BINDING_DEC_4_EVENT_ID>
 <BINDING_DEC_4_EVENT_ID_ONLY>True</BINDING_DEC_4_EVENT_ID_ONLY>
 <BINDING_DEC_5>Mixture_Incr#SUFFIX_ID#_Small</BINDING_DEC_5>
-<BINDING_DEC_5_PARAM_0>1</BINDING_DEC_0_PARAM_5>
+<BINDING_DEC_5_PARAM_0>1</BINDING_DEC_5_PARAM_0>
 <BINDING_DEC_5_EVENT_ID>MIXTURE#ID#_INCR_SMALL</BINDING_DEC_5_EVENT_ID>
 <BINDING_DEC_5_EVENT_ID_ONLY>True</BINDING_DEC_5_EVENT_ID_ONLY>
  
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Handling_Subtemplates.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Handling_Subtemplates.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Common/Subtemplates/Handling_Subtemplates.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Common/Subtemplates/Handling_Subtemplates.xml2021-11-27 00:40:53.000000000 +0200
@@ -1762,7 +1762,7 @@
 <IE_ID_EXTERNAL_0>Spoilers_Extend</IE_ID_EXTERNAL_0>
 <ON_PRIMARY_EVENT>(B:HANDLING_Spoilers) #POS_STANDBY# == if{ (&gt;B:HANDLING_Spoilers_Extend_Toggle) }</ON_PRIMARY_EVENT>
 <ANIM_CODE_PUSH>(B:HANDLING_Spoilers_Extend, Bool) 100 *</ANIM_CODE_PUSH>
-<OVERRIDE_ANIM_CODE>(B:HANDLING_Spoilers) 100 *</ANIM_CODE>
+<OVERRIDE_ANIM_CODE>(B:HANDLING_Spoilers) 100 *</OVERRIDE_ANIM_CODE>
 <ON_STATE_CHANGED_EXTERNAL_CODE>(O:HANDLING_Spoilers_Position) #POS_STANDBY# != (B:HANDLING_Spoilers_Extend, Bool) and if{ #POS_STANDBY# (&gt;O:HANDLING_Spoilers_Position) }</ON_STATE_CHANGED_EXTERNAL_CODE>
 <WWISE_PUSH_EVENT_1>spoilers_switch_push_on</WWISE_PUSH_EVENT_1>
 <WWISE_PUSH_EVENT_2>spoilers_switch_push_off</WWISE_PUSH_EVENT_2>
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Generic/Helpers.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Generic/Helpers.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Generic/Helpers.xml2020-12-22 21:43:36.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Generic/Helpers.xml2021-11-26 23:39:18.000000000 +0200
@@ -36,7 +36,7 @@
 <PARAM_TO_BUILD>#PARAM_TO_BUILD##PARAM_REPEATED_START##ID##PARAM_REPEATED_END#</PARAM_TO_BUILD>
 </False>
 </Condition>
-<TEST_ID Process="Param">ID#NEXT_ID#</NEXT_ID>
+<NEXT_ID Process="Param">ID#NEXT_ID#</NEXT_ID>
 </OverrideTemplateParameters>
 
 <Condition NotEmpty="TEST_ID">
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Generic/Interactions.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Generic/Interactions.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Generic/Interactions.xml2021-11-18 19:02:01.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Generic/Interactions.xml2021-11-27 00:23:48.000000000 +0200
@@ -2126,7 +2126,7 @@
 <Condition Check="ANIMREF_ID">
 <AnimRefID>#ANIMREF_ID#</AnimRefID>
 </Condition>
-<AnimCursor min="#ANIMCURSOR_MIN#" max="#ANIMCURSOR_MAX#">#ANIMCURSOR_DIR#</AnimCursorDir>
+<AnimCursorDir min="#ANIMCURSOR_MIN#" max="#ANIMCURSOR_MAX#">#ANIMCURSOR_DIR#</AnimCursorDir>
 <Condition Check="ANIMTIP_LOOP">
 <AnimTooltipLoop>#ANIMTIP_LOOP#</AnimTooltipLoop>
 </Condition>
diff -bru /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Generic/Updates.xml /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Generic/Updates.xml
--- /Users/tml/OneStore/fs-base-aircraft-common/ModelBehaviorDefs/Asobo/Generic/Updates.xml2020-12-22 21:43:36.000000000 +0200
+++ /Users/tml/Downloads/ModelBehaviorDefs/Asobo/Generic/Updates.xml2021-11-27 00:25:15.000000000 +0200
@@ -4,7 +4,7 @@
 <!-- ####################################################################### -->
 <!-- ######################### Update Templates ########################## -->
 <!-- ####################################################################### -->
-<!--
+
 <!--
 This template is used to ensure switches that have multiple state have the right state if their Simvar is changed.
 This should be the only entry point. Do not call GT_Update_EnsureVariableConsistency_MultiStates_ParamSetup_XStates.
flightmodelgauges
10 |10000 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

No Comments

· Write a Comment

Write a Comment

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.