Home | Class list | Files | Namespace Members | Class members | File members

irrXML 1.2 API documentation

logobig.png

Introduction

Welcome to the irrXML API documentation. Here you'll find any information you'll need to develop applications with irrXML. If you look for a tutorial on how to start, take a look at the Example, at the homepage of irrXML at xml.irrlicht3d.org or into the SDK in the directory

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:

Although irrXML has some strenghts, it currently also has the following limitations:

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 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;
        }

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:

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.

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.
irrXML
The irrXML Documentation © 2003-2005 by Nikolaus Gebhardt. Generated on Sat Nov 12 17:28:48 2005 by Doxygen (1.4.2)