diff options
author | Rob Bradford <rob@o-hand.com> | 2008-08-22 17:32:07 +0100 |
---|---|---|
committer | Rob Bradford <rob@o-hand.com> | 2008-08-22 17:32:07 +0100 |
commit | 4cd45fd6214907831e6864eb18691f885341c1f8 (patch) | |
tree | e6602bd81c991757d58b838682d3f78ab64dbbe1 /rest/rest-xml-parser.h | |
parent | 27ce1bbe72190a81fb8765b9954f7329aa1913f1 (diff) |
Add an XML parser that parses XML into a simple structure
Diffstat (limited to 'rest/rest-xml-parser.h')
-rw-r--r-- | rest/rest-xml-parser.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/rest/rest-xml-parser.h b/rest/rest-xml-parser.h new file mode 100644 index 0000000..060579f --- /dev/null +++ b/rest/rest-xml-parser.h @@ -0,0 +1,54 @@ +#ifndef _REST_XML_PARSER +#define _REST_XML_PARSER + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define REST_TYPE_XML_PARSER rest_xml_parser_get_type() + +#define REST_XML_PARSER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), REST_TYPE_XML_PARSER, RestXmlParser)) + +#define REST_XML_PARSER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), REST_TYPE_XML_PARSER, RestXmlParserClass)) + +#define REST_IS_XML_PARSER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), REST_TYPE_XML_PARSER)) + +#define REST_IS_XML_PARSER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), REST_TYPE_XML_PARSER)) + +#define REST_XML_PARSER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), REST_TYPE_XML_PARSER, RestXmlParserClass)) + +typedef struct { + GObject parent; +} RestXmlParser; + +typedef struct { + GObjectClass parent_class; +} RestXmlParserClass; + +typedef struct _RestXmlNode RestXmlNode; +struct _RestXmlNode { + gchar *name; + gchar *content; + GHashTable *children; + GHashTable *attrs; + RestXmlNode *next; +}; + +GType rest_xml_parser_get_type (void); + +RestXmlNode *rest_xml_node_new (void); +void rest_xml_node_free (RestXmlNode *node); + +RestXmlParser *rest_xml_parser_new (void); +RestXmlNode *rest_xml_parser_parse_from_data (RestXmlParser *parser, + const gchar *data, + gssize len); + +G_END_DECLS + +#endif /* _REST_XML_PARSER */ |