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

Revision:
0:3fa97f2c0505
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spxmlstag.hpp	Wed Nov 24 20:52:14 2010 +0000
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2007 Stephen Liu
+ * LGPL, see http://code.google.com/p/spxml/
+ * For license terms, see the file COPYING along with this library.
+ */
+
+#ifndef __spxmlstag_hpp__
+#define __spxmlstag_hpp__
+
+class SP_XmlSTagReader;
+class SP_XmlStartTagEvent;
+class SP_XmlStringBuffer;
+
+class SP_XmlSTagParser {
+public:
+    SP_XmlSTagParser( const char * encoding );
+    ~SP_XmlSTagParser();
+
+    void append( const char * source, int len );
+
+    SP_XmlStartTagEvent * takeEvent();
+    const char * getError();
+
+    const char * getEncoding();
+
+protected:
+    void changeReader( SP_XmlSTagReader * reader );
+    void setError( const char * error );
+
+    SP_XmlStartTagEvent * mEvent;
+
+    SP_XmlStringBuffer * mStartTagName;
+
+    friend class SP_XmlSTagReader;
+
+private:
+    SP_XmlSTagReader * mReader;
+    char * mError;
+    char mEncoding[ 32 ];
+};
+
+class SP_XmlSTagReader {
+public:
+    SP_XmlSTagReader();
+    virtual ~SP_XmlSTagReader();
+    virtual void read( SP_XmlSTagParser * parser, char c ) = 0;
+
+protected:
+
+    /// help to call parser->xxx
+    void changeReader( SP_XmlSTagParser * parser, SP_XmlSTagReader * reader );
+    void setError( SP_XmlSTagParser * parser, const char * error );
+
+    /// help to call parser->mEvent->xxx
+    void setName( SP_XmlSTagParser * parser, const char * name );
+    void addAttrName( SP_XmlSTagParser * parser, const char * name );
+    void addAttrValue( SP_XmlSTagParser * parser, const char * value );
+
+    SP_XmlStringBuffer * mBuffer;
+};
+
+class SP_XmlSTagNameReader : public SP_XmlSTagReader {
+public:
+    SP_XmlSTagNameReader();
+    virtual ~SP_XmlSTagNameReader();
+    virtual void read( SP_XmlSTagParser * parser, char c );
+};
+
+class SP_XmlSTagAttrNameReader : public SP_XmlSTagReader {
+public:
+    SP_XmlSTagAttrNameReader();
+    virtual ~SP_XmlSTagAttrNameReader();
+    virtual void read( SP_XmlSTagParser * parser, char c );
+
+private:
+    int mWait4Quot;
+};
+
+class SP_XmlSTagEqualMarkReader : public SP_XmlSTagReader {
+public:
+    SP_XmlSTagEqualMarkReader();
+    virtual ~SP_XmlSTagEqualMarkReader();
+    virtual void read( SP_XmlSTagParser * parser, char c );
+};
+
+class SP_XmlSTagAttrValueReader : public SP_XmlSTagReader {
+public:
+    SP_XmlSTagAttrValueReader();
+    virtual ~SP_XmlSTagAttrValueReader();
+    virtual void read( SP_XmlSTagParser * parser, char c );
+
+private:
+    int mHasReadQuot;
+};
+
+#endif
+