Registered: 1534093435 Posts: 6
Reply with quote #1
Foreword: this post will be a bit "techical", oriented mainly to software developers. I was looking at some mission files and I've noticed that their XML is very heavily attribute-oriented. This it not necessary a bad thing but it's a consolidated best-practice for XML documents to use elements for the "actual" object's data and attributes for the object's metadata (see https://www.w3schools.com/xml/xml_attributes.asp and https://stackoverflow.com/questions/1096797/should-i-use-elements-or-attributes-in-xml). For example, something like <create count="30" type="nebulas" nebType="1" startX="88169.0" startY="0.0" startZ="44203.0" endX="88169.0" endY="0.0" endZ="44203.0" randomRange="11324" /> could be written as <create> <type>nebula</type> <subtype>purple</subtype> <count>30</count> <start> <x>94380.0</x> <y>0.0</y> <z>38882.0</z> </start> <end> <x>81149.0</x> <y>0.0</y> <z>51745.0</z> </end> <range>2095</range> </create> A lot of programmers would argue about the excessive verbosity of this second version, but in my opinion something readable but verbose is better than something compact but illegible. An element-centred XML scheme is also simpler to use in an object-oriented programming language: classes can be easily mapped to and from this type of XML. In the example above, both <start> and <end> tags can be mapped to the same "Position" class with three properties: "x", "y" and "z". I'll end my ramblings with the definition of XML:
In computing, Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
Registered: 1375273622 Posts: 2,115
Reply with quote #2
I see your point. This format would make mission scripts a bit larger and lot longer. Of course you would only notice it in an XML text editor - - - in any sort of programming environment it would be invisible.
For those wanting to learn the raw XML coding it would make the learning process somewhat easier and the coding more foolproof. __________________ "The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight." - Winston Churchill