Download NHK English news podcast automatically. XML Parser "spxml" is used. This application requires mpod mother board. See also http://mbed.org/users/geodenx/notebook/mpod/

Dependencies:   BlinkLed HTTPClient EthernetInterface FatFileSystemCpp MSCFileSystem spxml mbed-rtos mbed

Fork of mpod_nhk_english by Satoshi Togawa

Download NHK English news podcast automatically.
XML Parser "spxml" is used.
This application requires mpod mother board.
See also http://mbed.org/users/geodenx/notebook/mpod/

Committer:
togayan
Date:
Mon Aug 20 13:27:17 2012 +0000
Revision:
4:7dae52cf560f
1st revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
togayan 4:7dae52cf560f 1 /*
togayan 4:7dae52cf560f 2 * Copyright 2008 Stephen Liu
togayan 4:7dae52cf560f 3 * For license terms, see the file COPYING along with this library.
togayan 4:7dae52cf560f 4 */
togayan 4:7dae52cf560f 5
togayan 4:7dae52cf560f 6 #ifndef __spxmlhandle_hpp__
togayan 4:7dae52cf560f 7 #define __spxmlhandle_hpp__
togayan 4:7dae52cf560f 8
togayan 4:7dae52cf560f 9 class SP_XmlNode;
togayan 4:7dae52cf560f 10
togayan 4:7dae52cf560f 11 class SP_XmlElementNode;
togayan 4:7dae52cf560f 12 class SP_XmlCDataNode;
togayan 4:7dae52cf560f 13 class SP_XmlCommentNode;
togayan 4:7dae52cf560f 14
togayan 4:7dae52cf560f 15 /**
togayan 4:7dae52cf560f 16 * This class is a clone of TinyXML's TiXmlHandle class.
togayan 4:7dae52cf560f 17 *
togayan 4:7dae52cf560f 18 *
togayan 4:7dae52cf560f 19 * A SP_XmlHandle is a class that wraps a node pointer with null checks; this is
togayan 4:7dae52cf560f 20 * an incredibly useful thing. Note that SP_XmlHandle is not part of the SPXml
togayan 4:7dae52cf560f 21 * DOM structure. It is a separate utility class.
togayan 4:7dae52cf560f 22 *
togayan 4:7dae52cf560f 23
togayan 4:7dae52cf560f 24 Take an example:
togayan 4:7dae52cf560f 25 @verbatim
togayan 4:7dae52cf560f 26 <Document>
togayan 4:7dae52cf560f 27 <Element attributeA = "valueA">
togayan 4:7dae52cf560f 28 <Child attributeB = "value1" />
togayan 4:7dae52cf560f 29 <Child attributeB = "value2" />
togayan 4:7dae52cf560f 30 </Element>
togayan 4:7dae52cf560f 31 <Document>
togayan 4:7dae52cf560f 32 @endverbatim
togayan 4:7dae52cf560f 33
togayan 4:7dae52cf560f 34 Assuming you want the value of "attributeB" in the 2nd "Child" element, a
togayan 4:7dae52cf560f 35 SP_XmlHandle checks for null pointers so it is perfectly safe and correct to use:
togayan 4:7dae52cf560f 36
togayan 4:7dae52cf560f 37 @verbatim
togayan 4:7dae52cf560f 38 SP_XmlHandle rootHandle( parser.getDocument()->getRootElement() );
togayan 4:7dae52cf560f 39 SP_XmlElementNode * child2 = rootHandle.getChild( "Element" )
togayan 4:7dae52cf560f 40 .getChild( "Child", 1 ).toElement();
togayan 4:7dae52cf560f 41
togayan 4:7dae52cf560f 42 if( child2 ) {
togayan 4:7dae52cf560f 43 // do something
togayan 4:7dae52cf560f 44 }
togayan 4:7dae52cf560f 45 @endverbatim
togayan 4:7dae52cf560f 46 *
togayan 4:7dae52cf560f 47 */
togayan 4:7dae52cf560f 48
togayan 4:7dae52cf560f 49 class SP_XmlHandle {
togayan 4:7dae52cf560f 50 public:
togayan 4:7dae52cf560f 51 SP_XmlHandle( SP_XmlNode * node );
togayan 4:7dae52cf560f 52 SP_XmlHandle( const SP_XmlHandle & ref );
togayan 4:7dae52cf560f 53 SP_XmlHandle & operator=( const SP_XmlHandle & ref );
togayan 4:7dae52cf560f 54
togayan 4:7dae52cf560f 55 ~SP_XmlHandle();
togayan 4:7dae52cf560f 56
togayan 4:7dae52cf560f 57 SP_XmlHandle getChild( const char * name, int index = 0 ) const;
togayan 4:7dae52cf560f 58
togayan 4:7dae52cf560f 59 SP_XmlHandle getChild( int index ) const;
togayan 4:7dae52cf560f 60
togayan 4:7dae52cf560f 61 SP_XmlHandle getElement( int index ) const;
togayan 4:7dae52cf560f 62
togayan 4:7dae52cf560f 63 SP_XmlNode * toNode();
togayan 4:7dae52cf560f 64
togayan 4:7dae52cf560f 65 SP_XmlElementNode * toElement();
togayan 4:7dae52cf560f 66
togayan 4:7dae52cf560f 67 SP_XmlCDataNode * toCData();
togayan 4:7dae52cf560f 68
togayan 4:7dae52cf560f 69 private:
togayan 4:7dae52cf560f 70 SP_XmlNode * mNode;
togayan 4:7dae52cf560f 71 };
togayan 4:7dae52cf560f 72
togayan 4:7dae52cf560f 73 #endif