irrXML:     About     API     License    Forum    Newsletter

irrXML


simple and fast open source xml parser for C++





irrXML is a simple and fast open source xml parser for C++. Why another xml parser? The strenghts of irrXML are its speed and its simplicity. It ideally fits into realtime projects which need to read xml data without overhead, like games. irrXML was originally written as part of the Irrlicht Engine but after it has become quite mature it now has become a separate project.

Download


Features
irrXML simply provides forward-only, read-only access to a stream of non validated XML data. 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.
  • It's open source, with an OSI certified license (zlib)
  • 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 of reading easily 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.



Example
The following code demonstrates the basic usage of irrXML. A simple xml file like this is parsed:

<?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 &quot;Irrlicht Engine&quot;.
</messageText>
</config>

The code for parsing this file would look like this:
#include <irrXML.h>
using namespace irr; // irrXML is located 
using namespace io;  // in the namespace irr::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; }



License


The license of irrXML is based on the zlib/libpng license, only the name and the authors name have been replaced. Even though this license does not require you to mention that you are using irrXML in your product, an acknowledgement would be highly appreciated.


Copyright © 2002-2007 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.







Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |