Home | Class list | Files | Namespace Members | Class members | File members |
irrXML is intended to be a high speed and easy-to-use XML Parser for C++, and this documentation is an important part of it. If you have any questions or suggestions, just send a email to the author of the engine, Nikolaus Gebhardt (niko (at) irrlicht3d.org). For more informations about this parser, see History.
Although irrXML has some strenghts, it currently also has the following limitations:
<?xml version="1.0"?> <config> <!-- This is a config file for the mesh viewer --> <model file="dwarf.dea" /> <messageText caption="Irrlicht Engine Mesh Viewer"> Welcome to the Mesh Viewer of the "Irrlicht Engine". </messageText> </config>
The code for parsing this file would look like this:
#include <irrXML.h> using namespace irr; // irrXML is located in the namespace irr::io using namespace io; #include <string> // we use STL strings to store data in this example void main() { // create the reader using one of the factory functions IrrXMLReader* xml = createIrrXMLReader("config.xml"); // strings for storing the data we want to get out of the file std::string modelFile; std::string messageText; std::string caption; // parse the file until end reached while(xml && xml->read()) { switch(xml->getNodeType()) { case EXN_TEXT: // in this xml file, the only text which occurs is the messageText messageText = xml->getNodeData(); break; case EXN_ELEMENT: { if (!strcmp("model", xml->getNodeName())) modelFile = xml->getAttributeValue("file"); else if (!strcmp("messageText", xml->getNodeName())) caption = xml->getAttributeValue("caption"); } break; } } // delete the xml parser after usage delete xml; }
Copyright (C) 2002-2005 Nikolaus Gebhardt
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.