In today's feature, Game programmer Christoph Luerig shows how the disadvantages of using XML in the large files commonly found in game development can be avoided by using the SAX (simple application interface for XML).
In this excerpt, he explains how XML can be used in game development and touches upon different methodologies:
"Modern game engines read a lot of data during game start up in nearly all sub-modules. The general data format XML is about to establish itself as the de facto norm in this area. One of its strength is ease of readability. Many standard tools and exporters for this format exist that make the game developer's life much easier. When using this data format in large files, however, one finds that the associated costs are higher memory consumption, longer reading times and memory fragmentation. These are especially painful in console game development.
In this article we show that these disadvantages can be avoided, not by using the standard DOM (document object model), but by using the SAX (simple application interface for XML). Both are different approaches to parsing XML data. The latter one is less known among game developers and seems to be a lot more difficult to use at first. However, we will show that, if applied properly, the amount of work that needs to be done is about the same for both approaches; only the control flow is different."
You can now read the full Gamasutra feature on the subject
, including plenty of code examples (no registration required, please feel free to link to this feature from external websites).