Loading...
Searching...
No Matches
irr::io::IIrrXMLReader< char_type, super_class > Class Template Referenceabstract

Interface providing easy read access to a XML file. More...

`#include <irrXML.h>`

Inheritance diagram for irr::io::IIrrXMLReader< char_type, super_class >:

## Public Member Functions

virtual | ~IIrrXMLReader ()
| Destructor.
virtual unsigned int | getAttributeCount () const =0
| Returns attribute count of the current XML node.
virtual const char_type * | getAttributeName (int idx) const =0
| Returns name of an attribute.
virtual const char_type * | getAttributeValue (const char_type *name) const =0
| Returns the value of an attribute.
virtual const char_type * | getAttributeValue (int idx) const =0
| Returns the value of an attribute.
virtual float | getAttributeValueAsFloat (const char_type *name) const =0
| Returns the value of an attribute as float.
virtual float | getAttributeValueAsFloat (int idx) const =0
| Returns the value of an attribute as float.
virtual int | getAttributeValueAsInt (const char_type *name) const =0
| Returns the value of an attribute as integer.
virtual int | getAttributeValueAsInt (int idx) const =0
| Returns the value of an attribute as integer.
virtual const char_type * | getAttributeValueSafe (const char_type *name) const =0
| Returns the value of an attribute in a safe way.
virtual const char_type * | getNodeData () const =0
| Returns data of the current node.
virtual const char_type * | getNodeName () const =0
| Returns the name of the current node.
virtual EXML_NODE | getNodeType () const =0
| Returns the type of the current XML node.
virtual ETEXT_FORMAT | getParserFormat () const =0
| Returns format of the strings returned by the parser.
virtual ETEXT_FORMAT | getSourceFormat () const =0
| Returns format of the source xml file.
virtual bool | isEmptyElement () const =0
| Returns if an element is an empty element, like <foo />.
virtual bool | read ()=0
| Reads forward to the next xml node.

## Detailed Description

template<class char_type, class super_class>
class irr::io::IIrrXMLReader< char_type, super_class >

Interface providing easy read access to a XML file.

You can create an instance of this reader using one of the factory functions createIrrXMLReader(), createIrrXMLReaderUTF16() and createIrrXMLReaderUTF32(). If using the parser from the Irrlicht Engine, please use IFileSystem::createXMLReader() instead. For a detailed intro how to use the parser, see Example and Features.

The typical usage of this parser looks like this:

#include <irrXML.h>
using namespace irr; // irrXML is located in the namespace irr::io
using namespace io;
void main()
{
// create the reader using one of the factory functions
IrrXMLReader* xml = createIrrXMLReader("config.xml");
if (xml == 0)
return; // file could not be opened
// parse the file until end reached
while(xml->read())
{
// based on xml->getNodeType(), do something.
}
// delete the xml parser after usage
delete xml;
}
irr::io::IIrrXMLReader::read
virtual bool read()=0
Reads forward to the next xml node.
irrXML.h
Header file of the irrXML, the Irrlicht XML parser.
irr::io
This namespace provides interfaces for input/output: Reading and writing files, accessing zip archive...
Definition EAttributes.h:11
irr::io::IrrXMLReader
IIrrXMLReader< char, IXMLBase > IrrXMLReader
A UTF-8 or ASCII character xml parser.
Definition irrXML.h:410
irr::io::createIrrXMLReader
IRRLICHT_API IrrXMLReader *IRRCALLCONV createIrrXMLReader(const char *filename)
Creates an instance of an UFT-8 or ASCII character xml parser.
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13

See Example for a more detailed example.

Definition at line 275 of file irrXML.h.

## Constructor & Destructor Documentation

## ~IIrrXMLReader()

template<class char_type, class super_class>

virtual irr::io::IIrrXMLReader< char_type, super_class >::~IIrrXMLReader | ( |  | ) |

inline virtual

Destructor.

Definition at line 280 of file irrXML.h.

## Member Function Documentation

## getAttributeCount()

template<class char_type, class super_class>

virtual unsigned int irr::io::IIrrXMLReader< char_type, super_class >::getAttributeCount | ( |  | ) | const

pure virtual

Returns attribute count of the current XML node.

This is usually non null if the current node is EXN_ELEMENT, and the element has attributes.

Returns
  Returns amount of attributes of this xml node.

## getAttributeName()

template<class char_type, class super_class>

virtual const char_type * irr::io::IIrrXMLReader< char_type, super_class >::getAttributeName | ( | int | idx | ) | const

pure virtual

Returns name of an attribute.

Parameters

  idx | Zero based index, should be something between 0 and getAttributeCount()-1.

Returns
  Name of the attribute, 0 if an attribute with this index does not exist.

## getAttributeValue() [1/2]

template<class char_type, class super_class>

virtual const char_type * irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValue | ( | const char_type * | name | ) | const

pure virtual

Returns the value of an attribute.

Parameters

  name | Name of the attribute.

Returns
  Value of the attribute, 0 if an attribute with this name does not exist.

## getAttributeValue() [2/2]

template<class char_type, class super_class>

virtual const char_type * irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValue | ( | int | idx | ) | const

pure virtual

Returns the value of an attribute.

Parameters

  idx | Zero based index, should be something between 0 and getAttributeCount()-1.

Returns
  Value of the attribute, 0 if an attribute with this index does not exist.

## getAttributeValueAsFloat() [1/2]

template<class char_type, class super_class>

virtual float irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValueAsFloat | ( | const char_type * | name | ) | const

pure virtual

Returns the value of an attribute as float.

Parameters

  name | Name of the attribute.

Returns
  Value of the attribute as float, and 0 if an attribute with this name does not exist or the value could not be interpreted as float.

## getAttributeValueAsFloat() [2/2]

template<class char_type, class super_class>

virtual float irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValueAsFloat | ( | int | idx | ) | const

pure virtual

Returns the value of an attribute as float.

Parameters

  idx | Zero based index, should be something between 0 and getAttributeCount()-1.

Returns
  Value of the attribute as float, and 0 if an attribute with this index does not exist or the value could not be interpreted as float.

## getAttributeValueAsInt() [1/2]

template<class char_type, class super_class>

virtual int irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValueAsInt | ( | const char_type * | name | ) | const

pure virtual

Returns the value of an attribute as integer.

Parameters

  name | Name of the attribute.

Returns
  Value of the attribute as integer, and 0 if an attribute with this name does not exist or the value could not be interpreted as integer.

## getAttributeValueAsInt() [2/2]

template<class char_type, class super_class>

virtual int irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValueAsInt | ( | int | idx | ) | const

pure virtual

Returns the value of an attribute as integer.

Parameters

  idx | Zero based index, should be something between 0 and getAttributeCount()-1.

Returns
  Value of the attribute as integer, and 0 if an attribute with this index does not exist or the value could not be interpreted as integer.

## getAttributeValueSafe()

template<class char_type, class super_class>

virtual const char_type * irr::io::IIrrXMLReader< char_type, super_class >::getAttributeValueSafe | ( | const char_type * | name | ) | const

pure virtual

Returns the value of an attribute in a safe way.

Like getAttributeValue(), but does not return 0 if the attribute does not exist. An empty string ("") is returned then.

Parameters

  name | Name of the attribute.

Returns
  Value of the attribute, and "" if an attribute with this name does not exist

## getNodeData()

template<class char_type, class super_class>

virtual const char_type * irr::io::IIrrXMLReader< char_type, super_class >::getNodeData | ( |  | ) | const

pure virtual

Returns data of the current node.

Only valid if the node has some data and it is of type EXN_TEXT, EXN_COMMENT, EXN_CDATA or EXN_UNKNOWN.

## getNodeName()

template<class char_type, class super_class>

virtual const char_type * irr::io::IIrrXMLReader< char_type, super_class >::getNodeName | ( |  | ) | const

pure virtual

Returns the name of the current node.

Only valid, if the node type is EXN_ELEMENT.

Returns
  Name of the current node or 0 if the node has no name.

## getNodeType()

template<class char_type, class super_class>

virtual EXML_NODE irr::io::IIrrXMLReader< char_type, super_class >::getNodeType | ( |  | ) | const

pure virtual

Returns the type of the current XML node.

## getParserFormat()

template<class char_type, class super_class>

virtual ETEXT_FORMAT irr::io::IIrrXMLReader< char_type, super_class >::getParserFormat | ( |  | ) | const

pure virtual

Returns format of the strings returned by the parser.

This will be UTF8 for example when you created a parser with IrrXMLReaderUTF8() and UTF32 when it has been created using IrrXMLReaderUTF32. It should not be necessary to call this method and only exists for informational purposes.

## getSourceFormat()

template<class char_type, class super_class>

virtual ETEXT_FORMAT irr::io::IIrrXMLReader< char_type, super_class >::getSourceFormat | ( |  | ) | const

pure virtual

Returns format of the source xml file.

It is not necessary to use this method because the parser will convert the input file format to the format wanted by the user when creating the parser. This method is useful to get/display additional informations.

## isEmptyElement()

template<class char_type, class super_class>

virtual bool irr::io::IIrrXMLReader< char_type, super_class >::isEmptyElement | ( |  | ) | const

pure virtual

Returns if an element is an empty element, like <foo />.

## read()

template<class char_type, class super_class>

virtual bool irr::io::IIrrXMLReader< char_type, super_class >::read | ( |  | ) |

pure virtual

Reads forward to the next xml node.

Returns
  Returns false, if there was no further node.

The documentation for this class was generated from the following file:

- irrXML.h

- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0