Mbed port of the Simple Plain Xml parser. See http://code.google.com/p/spxml/ for more details. This library uses less memory and is much better suited to streaming data than TinyXML (doesn\'t use as much C++ features, and especially works without streams). See http://mbed.org/users/hlipka/notebook/xml-parsing/ for usage examples.

Dependents:   spxmltest_weather VFD_fontx2_weather weather_LCD_display News_LCD_display ... more

Embed: (wiki syntax)

« Back to documentation index

SP_XmlHandle Class Reference

SP_XmlHandle Class Reference

This class is a clone of TinyXML's TiXmlHandle class. More...

#include <spxmlhandle.hpp>


Detailed Description

This class is a clone of TinyXML's TiXmlHandle class.

A SP_XmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that SP_XmlHandle is not part of the SPXml DOM structure. It is a separate utility class.

Take an example:

    <Document>
        <Element attributeA = "valueA">
            <Child attributeB = "value1" />
            <Child attributeB = "value2" />
        </Element>
    <Document>
    

Assuming you want the value of "attributeB" in the 2nd "Child" element, a SP_XmlHandle checks for null pointers so it is perfectly safe and correct to use:

    SP_XmlHandle rootHandle( parser.getDocument()->getRootElement() );
    SP_XmlElementNode * child2 = rootHandle.getChild( "Element" )
            .getChild( "Child", 1 ).toElement();

    if( child2 ) {
        // do something
    }
    

Definition at line 50 of file spxmlhandle.hpp.