Assimp  v4.1. (December 2018)
/opt/build/assimp-4.1.0~dfsg/contrib/irrXML/irrXML.h

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;
{
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.

~dfsg/contrib/irrXML/irrXML.h

Assimp::D3MF::XmlTag::mesh
static const std::string mesh
Definition: 3MFXmlTags.h:52
irr::io::EXN_ELEMENT
@ EXN_ELEMENT
A xml element, like <foo>
Definition: irrXML.h:186
Mesh
Definition: Mesh.h:27
testing::internal::string
::std::string string
Definition: gtest-port.h:1097
irrXML.h
setup.version
version
Definition: port/PyAssimp/setup.py:6
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1121
main
int main(int argc, char **argv)
Definition: sample10_unittest.cc:112
Assimp::D3MF::XmlTag::model
static const std::string model
Definition: 3MFXmlTags.h:47
irr
Definition: CXMLReaderImpl.h:22
irr::io::createIrrXMLReader
IrrXMLReader * createIrrXMLReader(const char *filename)
Creates an instance of an UFT-8 or ASCII character xml parser.
Definition: irrXML.cpp:88
irr::io::EXN_TEXT
@ EXN_TEXT
Text within a xml element: <foo> this is the text. </foo>
Definition: irrXML.h:192
structsgen.file
file
Definition: structsgen.py:286
irr::io::IrrXMLReader
IIrrXMLReader< char, IXMLBase > IrrXMLReader
A UTF-8 or ASCII character xml parser.
Definition: irrXML.h:384