RestXmlParser

## RestXmlParser RestXmlParser |

## Synopsis

                        RestXmlParser;
                        RestXmlNode;
    RestXmlParser *     rest_xml_parser_new                 (void);
    RestXmlNode *       rest_xml_parser_parse_from_data     (RestXmlParser *parser,
                                                             const gchar *data,
                                                             goffset len);
    RestXmlNode *       rest_xml_node_ref                   (RestXmlNode *node);
    void                rest_xml_node_unref                 (RestXmlNode *node);
    const gchar *       rest_xml_node_get_attr              (RestXmlNode *node,
                                                             const gchar *attr_name);
    RestXmlNode *       rest_xml_node_find                  (RestXmlNode *node,
                                                             const gchar *tag);

## Object Hierarchy

      GObject
       +----RestXmlParser

## Description

## Details

### RestXmlParser

    typedef struct _RestXmlParser RestXmlParser;

### RestXmlNode

    typedef struct {
      gchar *name;
      gchar *content;
      GHashTable *children;
      GHashTable *attrs;
      RestXmlNode *next;
    } RestXmlNode;

gchar *`name`; | the name of the element
gchar *`content`; | the textual content of the element
GHashTable *`children`; | a GHashTable of string name to RestXmlNode for the children of the element.
GHashTable *`attrs`; | a GHashTable of string name to string values for the attributes of the element.
RestXmlNode *`next`; | the sibling RestXmlNode with the same name

### rest_xml_parser_new ()

    RestXmlParser *     rest_xml_parser_new                 (void);

Create a new RestXmlParser, for parsing XML documents.

Returns : | a new RestXmlParser.

### rest_xml_parser_parse_from_data ()

    RestXmlNode *       rest_xml_parser_parse_from_data     (RestXmlParser *parser,
                                                             const gchar *data,
                                                             goffset len);

Parse the XML in `data`, and return a new RestXmlNode. If `data` is invalid XML, `NULL` is returned.

`parser` : | a RestXmlParser
`data` : | the XML content to parse
`len` : | the length of `data`
Returns : | a new RestXmlNode, or `NULL` if the XML was invalid.

### rest_xml_node_ref ()

    RestXmlNode *       rest_xml_node_ref                   (RestXmlNode *node);

Increases the reference count of `node`.

`node` : | a RestXmlNode
Returns : | the same `node`.

### rest_xml_node_unref ()

    void                rest_xml_node_unref                 (RestXmlNode *node);

Decreases the reference count of `node`. When its reference count drops to 0, the node is finalized (i.e. its memory is freed).

`node` : | a RestXmlNode

### rest_xml_node_get_attr ()

    const gchar *       rest_xml_node_get_attr              (RestXmlNode *node,
                                                             const gchar *attr_name);

Get the value of the attribute named `attr_name`, or `NULL` if it doesn't exist.

`node` : | a RestXmlNode
`attr_name` : | the name of an attribute
Returns : | the attribute value. This string is owned by RestXmlNode and should not be freed.

### rest_xml_node_find ()

    RestXmlNode *       rest_xml_node_find                  (RestXmlNode *node,
                                                             const gchar *tag);

Searches for the first child node of `start` named `tag`.

`start` : | a RestXmlNode
`tag` : | the name of a node
Returns : | the first child node, or `NULL` if it doesn't exist.