Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by landauf, 7 years ago) (diff)

fixed links

XML-Loader

The goal of the XML-Loader is to import levels defined in an XML-File into the game engine. This is done by parsing a specified XML-File and adding all defined Entities for the Scene-Manager.

XML-Design

See content/LevelHowTo (don't know if this is still up to date…)

Ticket

This page referrers to Ticket 232 which is maintained by Nicolas Perrenoud

Library

I'm using the xmlParser Library from Frank Vanden Berghen which is small, simple to use and fast. (Download). It uses only one class, which is defined in xmlParser.cpp, xmlParser.h The class XMLNode reflects an Node in the XML-File. It has methods to get the child nodes, get the attributes and inner text.

Example:

<root>

<level name="Argon Prime">

Lorem Ipsum dolor sit amet

</level>

</root>

XMLNode xMainNode=XMLNode::openFileHelper("level.xml","root"); This loads the xml file and defines root as the main node

XMLNode xNode=xMainNode.getChildNode("level"); This creates a new node object of child node <level>

cout << xNode.getAttribute("name"); This prints the value xNode's attribute name, in this case Argon Prime

cout << xNode.getText()); This prints the inner content of xNode, in this case Lorem Ipsum dolor sit amet

Misc

See XML-Writer for an XML-Writer description