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
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/
Diff: spxml/spxmlhandle.cpp
- Revision:
- 8:a9541e8897f5
- Parent:
- 7:ad9fcf0e1bc5
--- a/spxml/spxmlhandle.cpp Sat Sep 01 04:09:48 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* - * Copyright 2008 Stephen Liu - * For license terms, see the file COPYING along with this library. - */ - -#include <stdio.h> -#include <string.h> - -#include "spxmlhandle.hpp" -#include "spxmlnode.hpp" - - -SP_XmlHandle :: SP_XmlHandle( SP_XmlNode * node ) -{ - mNode = node; -} - -SP_XmlHandle :: SP_XmlHandle( const SP_XmlHandle & ref ) -{ - mNode = ref.mNode; -} - -SP_XmlHandle & SP_XmlHandle :: operator=( const SP_XmlHandle & ref ) -{ - mNode = ref.mNode; - return *this; -} - -SP_XmlHandle :: ~SP_XmlHandle() -{ -} - -SP_XmlHandle SP_XmlHandle :: getChild( const char * name, int index ) const -{ - SP_XmlNode * ret = NULL; - - if( NULL != mNode ) { - if( SP_XmlNode::eELEMENT == mNode->getType() ) { - SP_XmlElementNode * element = (SP_XmlElementNode*)mNode; - const SP_XmlNodeList * children = element->getChildren(); - - int tmpIndex = index; - for( int i = 0; i < children->getLength(); i++ ) { - if( SP_XmlNode::eELEMENT == children->get(i)->getType() ) { - SP_XmlElementNode * iter = (SP_XmlElementNode*)children->get(i); - if( 0 == strcmp( name, iter->getName() ) ) { - if( 0 == tmpIndex ) { - ret = iter; - break; - } - tmpIndex--; - } - } - } - } - } - - return SP_XmlHandle( ret ); -} - -SP_XmlHandle SP_XmlHandle :: getChild( int index ) const -{ - SP_XmlNode * ret = NULL; - - if( NULL != mNode ) { - if( SP_XmlNode::eELEMENT == mNode->getType() ) { - SP_XmlElementNode * element = (SP_XmlElementNode*)mNode; - ret = (SP_XmlNode*)element->getChildren()->get( index ); - } - } - - return SP_XmlHandle( ret ); -} - -SP_XmlHandle SP_XmlHandle :: getElement( int index ) const -{ - SP_XmlNode * ret = NULL; - - if( NULL != mNode ) { - if( SP_XmlNode::eELEMENT == mNode->getType() ) { - SP_XmlElementNode * element = (SP_XmlElementNode*)mNode; - const SP_XmlNodeList * children = element->getChildren(); - - int tmpIndex = index; - for( int i = 0; i < children->getLength(); i++ ) { - if( SP_XmlNode::eELEMENT == children->get(i)->getType() ) { - SP_XmlElementNode * iter = (SP_XmlElementNode*)children->get(i); - - if( 0 == tmpIndex ) { - ret = iter; - break; - } - tmpIndex--; - } - } - } - } - - return SP_XmlHandle( ret ); -} - -SP_XmlNode * SP_XmlHandle :: toNode() -{ - return mNode; -} - -SP_XmlElementNode * SP_XmlHandle :: toElement() -{ - if( NULL != mNode && SP_XmlNode::eELEMENT == mNode->getType() ) { - return (SP_XmlElementNode*)mNode; - } - - return NULL; -} - -SP_XmlCDataNode * SP_XmlHandle :: toCData() -{ - if( NULL != mNode && SP_XmlNode::eCDATA == mNode->getType() ) { - return (SP_XmlCDataNode*)mNode; - } - - return NULL; -}