Xml2Tmx - A Utility For Aircraft Developers

  • I've recently dipped my feet into developing aircraft. (More on that project later). One thing that I just couldn't get to grips with is the huge TMD files. Scrolling around a file with tens of thousands of lines with no syntax highlighting or error checking isn't fun. I felt like I couldn't get a handle on all the different parts of the file and how they tie together.

    So, I spent a couple of evenings coding up a simple utility that can convert XML to TMD or TMC files (let's call them TMX) and also TMX to XML.

    Doing this gives a few of advantages:

    • You can edit the XML with your favour editor and get syntax highlighting
    • You'll also get real-time XML syntax checking from your editor
    • You can fold sections away with your XML editor
    • Using XML includes you can break the file into lots of smaller files, neatly arranged into a separate folders

    A picture is worth a 1000 words and all that...

    Here's my root file for the aircraft (early days, don't judge), all in XML, and it just imports other files.

    If you take a look at the left sidebar you'll see how I've broken the aircraft source up into many different files and folders.

    In my opinion this makes things so much easier to deal with.

    The aircraft code becomes a real project with a logical layout. You know where to find things without searching.

    In this screenshot there's one XML include file, this one is specific to cameras.

    I can put all the documentation I need in these individual files as they are specific to one area of the aircraft.

    When I want to compile things down to a single TMD I run.

    Xml2Tmx ConvertToTmx -input "c208.xml" -output "c208.tmd"

    If you want to convert an existing TMD to XML, to allow it to be split up you can do the opposite

    Xml2Tmx ConvertToXml -input "c208.tmd" -output "c208.xml"

    Obviously, this is very niche appeal. I wrote it for myself, but if anyone else thinks it might be of use to them, let me know, and I'll add some error checking a do a public release.

  • Thank you, we need more stuff like that.

    I want to develop aircraft, but the task is daunting, the more tools like this we get, the simpler it makes it. Every single step is great contribution.

    I wish I knew how to do such coding, a graphical UI for aircraft dev, would be so great (like when you hover over the engine, you see what it requires and the values and can input new values, etc...)

  • Some microlight aircraft would be nice too!!!!!!!!!!!!!!!!!!

    Windows 7 Home Premium 64-bit SP1, Intel Pentium G2130 @ 3.20GHz, 16.0 GB RAM DDR3, ASUS H61M-K, Graphics PHL 273V5 1920x1080 @ 60Hz, NVIDIA GeForce GTX960, Thrustmaster Joystick and Home Made Rudder Pedals. DVD version of FS2.

  • :D The name of my main file is C208. Answers on a postcard!

    Will do a separate post when I have something more to show.

    Excellent choice. Round gauge or G1000?

    A steely-eyed Sierra Hotel record setting F-15E Strike Eagle simulator pilot. 8o
    Out now: Hawaiian Islands 8) Part 1: Kauai + Niihau v2 and Part 2 Oahu Island.

    On short final Part 3: Molokai, Maui, Lanai, Kohoolawe + Molokini Crater

  • Maybe we need to assemble a collective like we did on the Apollo 50. Ray?

    I've got a few projects, mostly modifying an F18 into A10, SR71, Super hornet (F18E). All are military, all are twin engines.

    Any taker?

    Sounds good. Let's see if there is any interest. I am on vacation with only an iPad and phone.

    A steely-eyed Sierra Hotel record setting F-15E Strike Eagle simulator pilot. 8o
    Out now: Hawaiian Islands 8) Part 1: Kauai + Niihau v2 and Part 2 Oahu Island.

    On short final Part 3: Molokai, Maui, Lanai, Kohoolawe + Molokini Crater

    • Official Post

    That's useful in it's own right. Is it in a post here?

    What I liked about converting to and from XML is that you can use any IDE like VS Code, and I could also split it into small files using XML includes.

    Since I'm coding the TMDs in Visual Studio now too I don't use Notepad++ for that any more and the keywords are outdated. I mean you could renew them with the code snippets tool that I provided https://www.aerofly-sim.de/dow…oad-software/codesnippets but I sort of got used to the black on white style and my eyes just snap to the important bits inside the third pair of square brackets.

    That's why for me an xml editor style would slow things down, I'm just not used to reading xml code. But if you're used to it I see that it might speed things up for you. and that's a good thing. The only issue that I would see is: how do I add comments and how do I indent parameters in a block form, e.g. like for aerowings. Usually I do " 1.0 0.0 0.0 " for the string, with leading and trailing white space, which might look weird in xml.... but in tmd block form it works great: [ 1.0 0.0 0.0 ] looks more like my c++ code ( 1.0 0.0 0.0 ) and without that it looks too cramped and isn't easy to read [1.0 0.0 0.0 ]. This makes a difference after 8 hours of work. In Jeremy Clarkson's voice: "Whitespace gooood. No whitespace baaaad." 8o^^

    And on top of the readability... I wonder how do you "ctrl+s", "alt+tab" + reload in aerofly then? I imagine you would have to compile your xml back to tmd first and that takes a couple more clicks or key strokes I guess? Unless you hook it up to your IDE commands. And I sometimes do that 10x a minute, so even the "ctrl+s" and "alt+tab" already gets annoying.

    That Notepad++ language file also offers code folding but I didn't use it much. What I do do is have multiple instances of the same file open in Visual Studio, with vertical split and horizontal split.

    I'm not saying that it always looks like this: but it can look like this and it helps to edit multiple sections at the same time.

    ( DO NOT SHARE THIS PICTURE - also because of what I'm editing ;) ... no comment )

    And on my wide screen monitor at my work place I have much more space laterally for this kind of stuff.

    What I would like to see is an short hand version of the tmd code.

    e.g. from this:

    Down to something this: