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.
Features
irrXML provides forward-only, read-only access to a stream of non validated XML data. It was fully implemented by Nikolaus Gebhardt. Its current features are:
- It it fast as lighting and has very low memory usage. It was developed with the intention of being used in 3D games, as it already has been.
- irrXML is very small: It only consists of 60 KB of code and can be added easily to your existing project.
- Of course, it is platform independent and works with lots of compilers.
- It is able to parse ASCII, UTF-8, UTF-16 and UTF-32 text files, both in little and big endian format.
- Independent of the input file format, the parser can return all strings in ASCII, UTF-8, UTF-16 and UTF-32 format.
- With its optional file access abstraction it has the advantage that it can read not only from files but from any type of data (memory, network, ...). For example when used with the Irrlicht Engine, it directly reads from compressed .zip files.
- Just like the Irrlicht Engine for which it was originally created, it is extremely easy to use.
- It has no external dependencies, it does not even need the STL.
Although irrXML has some strenghts, it currently also has the following limitations:
- The input xml file is not validated and assumed to be correct.
Example
The following code demonstrates the basic usage of irrXML. A simple xml file like this is parsed:
<config>
<!-- This is
a config
file for the
mesh viewer -->
<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:
using namespace io;
#include <string>
{
while(xml && xml->read())
{
switch(xml->getNodeType())
{
messageText = xml->getNodeData();
break;
{
if (!strcmp("model", xml->getNodeName()))
modelFile = xml->getAttributeValue("file");
else
if (!strcmp("messageText", xml->getNodeName()))
caption = xml->getAttributeValue("caption");
}
break;
}
}
delete xml;
}
How to use
Simply add the source files in the /src directory of irrXML to your project. Done.
License
The irrXML license is based on the zlib license. Basicly, this means you can do with irrXML whatever you want:
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:
- 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.
- Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
- This notice may not be removed or altered from any source distribution.
History
As lots of references in this documentation and the source show, this xml parser has originally been a part of the Irrlicht Engine. But because the parser has become very useful with the latest release, people asked for a separate version of it, to be able to use it in non Irrlicht projects. With irrXML 1.0, this has now been done.
~ds0/contrib/irrXML/irrXML.h