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!


question

tml avatar image
tml asked tml edited

Has anybody written a tool to expand an XML template invocation?

I wonder, has anybody bothered to write a tool that would read an XML fragment that contains a UseTemplate element and not much else, and then load all the template definitions, and spit out what the XML fragment actually expands to? Would make understanding how to create various XML things much easier... I feel anybody who is getting into add-on development is going through the same process, and manually diving into template after template to see what they actually end up with;)

aircraftgaugesanimation
1 comment
10 |10000

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

tml avatar image tml commented ·

And when I start writing such a tool, of course I run into fundamental XML syntax issues in the bundled template files. Like already in Asobo/Generic/Helpers.xml. Line 39 is:

<TEST_ID Process="Param">ID#NEXT_ID#</NEXT_ID>

which obviously is incorrect XML syntax. The TEST_ID should be NEXT_ID.

0 Likes 0 ·
tml avatar image
tml answered tml edited

OK, so I started on it, but yeah, it turns out to be much more complicated than I had hoped, and require more effort than I can be bothered with at the moment... One complication is that such a tool would need to include a RPN interpreter to handle template parameter attributes when the Process attribute has value "Int", "Float", or "String". The contents of such a parameter is an RPN snippet that needs to be evaluated at template expansion time, if I understand correctly. Oh well, at least I learned a bit more about the magic of templates.

I still am not fully certain to what extent I want or need to use the Asobo templates, though. One open question is whether they are even supposed to be used random add-on aircraft developers like myself for instruments and gauges that don't really match any of the Asobo ones in behaviour? Or are they developed only for use by Asobo's own aircraft, without any API stability guarantees? On one hand, many are documented to some extend in the SDK, but on the other hand, some of them seem to contain implementation details related to specific Asobo aircraft.

10 |10000

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

tml avatar image
tml answered tml edited

After some more hacking, I now have something that works, at least a bit, here. Patches welcome.

10 |10000

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

tml avatar image
tml answered tml edited

... and now it is able to expand the whole DA62_interior.xml from the SDK DA62 sample aircraft. Hopefully it will be useful to somebody else, too.

10 |10000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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