cd-dom

## cd-dom cd-dom — A XML parser that exposes a DOM tree |

## Synopsis

    #define             CD_DOM_ERROR
    #define             CD_DOM_TYPE_ERROR
    void                (*_cd_dom_reserved1)                (void);
    void                (*_cd_dom_reserved2)                (void);
    void                (*_cd_dom_reserved3)                (void);
    void                (*_cd_dom_reserved4)                (void);
    void                (*_cd_dom_reserved5)                (void);
    void                (*_cd_dom_reserved6)                (void);
    void                (*_cd_dom_reserved7)                (void);
    void                (*_cd_dom_reserved8)                (void);
    GQuark              cd_dom_error_quark                  (void);
    CdDom *             cd_dom_new                          (void);
    gchar *             cd_dom_to_string                    (CdDom *dom);
    gboolean            cd_dom_parse_xml_data               (CdDom *dom,
                                                             const gchar *data,
                                                             gssize data_len,
                                                             GError **error);
    const GNode *       cd_dom_get_node                     (CdDom *dom,
                                                             const GNode *root,
                                                             const gchar *path);
    const gchar *       cd_dom_get_node_name                (const GNode *node);
    const gchar *       cd_dom_get_node_data                (const GNode *node);
    gint                cd_dom_get_node_data_as_int         (const GNode *node);
    gdouble             cd_dom_get_node_data_as_double      (const GNode *node);
    const gchar *       cd_dom_get_node_attribute           (const GNode *node,
                                                             const gchar *key);
    gboolean            cd_dom_get_node_rgb                 (const GNode *node,
                                                             CdColorRGB *rgb);
    gboolean            cd_dom_get_node_yxy                 (const GNode *node,
                                                             CdColorYxy *yxy);
    gboolean            cd_dom_get_node_lab                 (const GNode *node,
                                                             CdColorLab *lab);
    GHashTable *        cd_dom_get_node_localized           (const GNode *node,
                                                             const gchar *key);

## Description

## Details

### CD_DOM_ERROR

    #define CD_DOM_ERROR		(cd_dom_error_quark ())

### CD_DOM_TYPE_ERROR

    #define CD_DOM_TYPE_ERROR (cd_dom_error_get_type ())

### _cd_dom_reserved1 ()

    void                (*_cd_dom_reserved1)                (void);

### _cd_dom_reserved2 ()

    void                (*_cd_dom_reserved2)                (void);

### _cd_dom_reserved3 ()

    void                (*_cd_dom_reserved3)                (void);

### _cd_dom_reserved4 ()

    void                (*_cd_dom_reserved4)                (void);

### _cd_dom_reserved5 ()

    void                (*_cd_dom_reserved5)                (void);

### _cd_dom_reserved6 ()

    void                (*_cd_dom_reserved6)                (void);

### _cd_dom_reserved7 ()

    void                (*_cd_dom_reserved7)                (void);

### _cd_dom_reserved8 ()

    void                (*_cd_dom_reserved8)                (void);

### cd_dom_error_quark ()

    GQuark              cd_dom_error_quark                  (void);

Returns : | An error quark.

Since 0.1.31

### cd_dom_new ()

    CdDom *             cd_dom_new                          (void);

Creates a new CdDom object.

Returns : | a new CdDom object.

Since 0.1.31

### cd_dom_to_string ()

    gchar *             cd_dom_to_string                    (CdDom *dom);

Returns a string representation of the DOM tree.

`dom` : | a CdDom instance.
Returns : | an allocated string

Since 0.1.31

### cd_dom_parse_xml_data ()

    gboolean            cd_dom_parse_xml_data               (CdDom *dom,
                                                             const gchar *data,
                                                             gssize data_len,
                                                             GError **error);

Parses data into a DOM tree.

`dom` : | a CdDom instance.
`data` : | XML data
`data_len` : | Length of `data`, or -1 if NULL terminated
`error` : | A GError or `NULL`

Since 0.1.31

### cd_dom_get_node ()

    const GNode *       cd_dom_get_node                     (CdDom *dom,
                                                             const GNode *root,
                                                             const gchar *path);

Gets a node from the DOM tree.

`dom` : | a CdDom instance.
`root` : | a root node, or `NULL`
`path` : | a path in the DOM, e.g. "html/body"
Returns : | A GNode, or `NULL` if not found

Since 0.1.31

### cd_dom_get_node_name ()

    const gchar *       cd_dom_get_node_name                (const GNode *node);

Gets the node name, e.g. "body"

`node` : | a GNode
Returns : | string value

Since 0.1.31

### cd_dom_get_node_data ()

    const gchar *       cd_dom_get_node_data                (const GNode *node);

Gets the node data, e.g. "paragraph text"

`node` : | a GNode
Returns : | string value

Since 0.1.31

### cd_dom_get_node_data_as_int ()

    gint                cd_dom_get_node_data_as_int         (const GNode *node);

Gets the node data, e.g. 128

`node` : | a GNode
Returns : | signed integer value, or `G_MAXINT` for error

Since 0.1.32

### cd_dom_get_node_data_as_double ()

    gdouble             cd_dom_get_node_data_as_double      (const GNode *node);

Gets the node data, e.g. 7.4

`node` : | a GNode
Returns : | floating point value, or `G_MAXDOUBLE` for error

Since 0.1.32

### cd_dom_get_node_attribute ()

    const gchar *       cd_dom_get_node_attribute           (const GNode *node,
                                                             const gchar *key);

Gets a node attribute, e.g. "false"

`node` : | a GNode
Returns : | string value

Since 0.1.31

### cd_dom_get_node_rgb ()

    gboolean            cd_dom_get_node_rgb                 (const GNode *node,
                                                             CdColorRGB *rgb);

Extracts a RGB color value from the DOM tree

`node` : | a GNode
`rgb` : | a CdColorRGB
Returns : | `TRUE` if the color was parsed successfully

Since 0.1.31

### cd_dom_get_node_yxy ()

    gboolean            cd_dom_get_node_yxy                 (const GNode *node,
                                                             CdColorYxy *yxy);

Extracts a Yxy color value from the DOM tree

`node` : | a GNode
`yxy` : | a CdColorYxy
Returns : | `TRUE` if the color was parsed successfully

Since 0.1.31

### cd_dom_get_node_lab ()

    gboolean            cd_dom_get_node_lab                 (const GNode *node,
                                                             CdColorLab *lab);

Extracts a Lab color value from the DOM tree

`node` : | a GNode
`lab` : | a CdColorLab
Returns : | `TRUE` if the color was parsed successfully

Since 0.1.31

### cd_dom_get_node_localized ()

    GHashTable *        cd_dom_get_node_localized           (const GNode *node,
                                                             const gchar *key);

Extracts localized values from the DOM tree

`node` : | a GNode
`key` : | the key to use, e.g. "copyright"
Returns : | A hash table with the locale (e.g. en_GB) as the key. [transfer full]

Since 0.1.31