Contrary to what I expected I ended up spending the day looking into XML, xml-parsers and map importing. I kicked things off by familiarizing myself with XML; turns out I had a decent grasp on how XML worked already. I did, however, learn that it was possible to define a “Document Type Definition” or DTD to specify which tags have what, which attributes exist of tags, and the like. I threw together a simple DTD for the map metalanguage; It allows the map to have multiple constellations, each with a name attribute. Those constellations can then have multiple planets. Each planet has a name, id, x, y attribute, as well as any number of “id”s of adjacent planets.
Here is the DTD for those versed in XML:
!DOCTYPE MAP [
!ELEMENT MAP (CNST)>
!ELEMENT CNST (PLNT)>
!ATTLIST CNST name CDATA #REQUIRED>
!ELEMENT PLNT (ID*)>
!ATTLIST PLNT name CDATA #REQUIRED>
!ATTLIST PLNT id CDATA #REQUIRED>
!ATTLIST PLNT x CDATA #REQUIRED>
!ATTLIST PLNT y CDATA #REQUIRED>
!ELEMENT ID (#PCDATA)>
]>
(I had to remove the beginning braces because of display issues)
The only issue a predefined DTD raises is that it creates the need for a more sophisticated xml parser. My original intention was to use the TinyXml parser, but in its frugality it omits DTD validation of XML. DTD is a feature I think is fairly important for a map import class, primarily because a validated XML doc should THEORETICALLY contain a valid map (if my DTD does the job correctly.) That valid XML could then be imported via DOM, possibly directly, into the game. While a DOM import would be nice, it may not be possible. My backup plan would be the following:
Going back to choosing an XML parser; My next candidate to investigate, and the #1 result when you search for “XML C++ Parser” is the Xerces C++ Parser. From what I understand, Xerces is a little bit more robust XML parser. While TinyXML is under a fairly loose license, Xerces is under the Apache General License, so I’m not entirely sure about its usability.
In other news: I just received an EZFLASH 3-in-1 GBA cart for my Nintendo DS, and so I will be bidding you all adieu to muck around with all the GBA homebrew (and other stuff) I can!