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 @@
-#NODE_ID_HANDLE#
+#NODE_ID_HANDLE#
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 @@
-
+
AUTOPILOT
AUTOPILOT_Knob_Baro_#ID##SUFFIX_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 @@
-0
-1
-2
+0
+1
+2
0
@@ -652,7 +652,7 @@
(B:DEICE_Pitot_#ID#)
-(B:DEICE_Pitot_#ID#) !
+(B:DEICE_Pitot_#ID#) !
(B:DEICE_Pitot_#ID#) 100 *
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 @@
(#DRAG_ANIMATION_VARIABLE_TYPE#:#DRAG_ANIMATION_VARIABLE_NAME#)
-(* 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 & 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 < if{
(#POSITION_TYPE#:#POSITION_VAR#) 1 >= if{
@@ -2371,7 +2371,7 @@
}
}
-
+
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 @@
-#SELECTOR_STATE_COUNT_T# 1 +
+#SELECTOR_STATE_COUNT_T# 1 +
SELECTOR_STATE_#SEL_ID#
@@ -1431,7 +1431,7 @@
0 (>#CUTOFF_VAR#) 0 (>K:SET_FUEL_VALVE_ENG#ID#) 0 (>A:TURB ENG CONDITION LEVER POSITION:#ID#,enum)
High_Idle
-Low_Idle
+Low_Idle
Cut_Off
False
@@ -1482,19 +1482,19 @@
MIXTURE_DECR_SMALL
True
Mixture_Decr#SUFFIX_ID#
-1
+1
MIXTURE#ID#_DECR
True
CONDITION_LEVER_DEC
-1
+1
CONDITION_LEVER_DEC
True
CONDITION_LEVER#SUFFIX_ID#_DEC
-1
+1
CONDITION_LEVER#SUFFIX_ID#_DEC
True
Mixture_Decr#SUFFIX_ID#_Small
-1
+1
MIXTURE#ID#_DECR_SMALL
True
@@ -1512,15 +1512,15 @@
True
1
CONDITION_LEVER_INC
-1
+1
CONDITION_LEVER_INC
True
CONDITION_LEVER#SUFFIX_ID#_INC
-1
+1
CONDITION_LEVER#SUFFIX_ID#_INC
True
Mixture_Incr#SUFFIX_ID#_Small
-1
+1
MIXTURE#ID#_INCR_SMALL
True
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 @@
Spoilers_Extend
(B:HANDLING_Spoilers) #POS_STANDBY# == if{ (>B:HANDLING_Spoilers_Extend_Toggle) }
(B:HANDLING_Spoilers_Extend, Bool) 100 *
-(B:HANDLING_Spoilers) 100 *
+(B:HANDLING_Spoilers) 100 *
(O:HANDLING_Spoilers_Position) #POS_STANDBY# != (B:HANDLING_Spoilers_Extend, Bool) and if{ #POS_STANDBY# (>O:HANDLING_Spoilers_Position) }
spoilers_switch_push_on
spoilers_switch_push_off
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_REPEATED_START##ID##PARAM_REPEATED_END#
-ID#NEXT_ID#
+ID#NEXT_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 @@
#ANIMREF_ID#
-#ANIMCURSOR_DIR#
+#ANIMCURSOR_DIR#
#ANIMTIP_LOOP#
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 @@
-<!--
+
<!--
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.</code>