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

Show/hide line numbers spxmlcodec.hpp Source File

spxmlcodec.hpp

00001 /*
00002  * Copyright 2007 Stephen Liu
00003  * LGPL, see http://code.google.com/p/spxml/
00004  * For license terms, see the file COPYING along with this library.
00005  */
00006 
00007 #ifndef __spxmlcodec_hpp__
00008 #define __spxmlcodec_hpp__
00009 
00010 class SP_XmlStringBuffer;
00011 
00012 class SP_XmlStringCodec {
00013 public:
00014 
00015     static const char * DEFAULT_ENCODING;
00016 
00017     static int decode( const char * encoding,
00018             const char * encodeValue, SP_XmlStringBuffer * outBuffer );
00019     static int encode( const char * encoding,
00020             const char * decodeValue, SP_XmlStringBuffer * outBuffer );
00021     static int isNameChar( const char * encoding, char c );
00022 
00023 private:
00024     static const char XML_CHARS [];
00025     static const char * ESC_CHARS [];
00026 
00027     SP_XmlStringCodec();
00028 };
00029 
00030 class SP_XmlUtf8Codec {
00031 public:
00032 
00033     // @return convert how many bytes
00034     static int utf82uni( const unsigned char * utf8, int * ch );
00035 
00036     static void uni2utf8( int ch, SP_XmlStringBuffer * outBuffer );
00037 
00038 private:
00039     SP_XmlUtf8Codec();
00040 };
00041 
00042 #endif
00043