CdDom

CdDom — A XML parser that exposes a DOM tree

Functions

Types and Values

#define CD_DOM_ERROR
#define CD_DOM_TYPE_ERROR
#define CD_TYPE_DOM
struct CdDomClass
  CdDom

Object Hierarchy

    GObject
    ╰── CdDom

Description

Functions

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.

Parameters

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.

Parameters

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.

Parameters

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"

Parameters

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"

Parameters

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

Parameters

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

Parameters

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"

Parameters

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

Parameters

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

Parameters

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

Parameters

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

Parameters

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

Types and Values

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_TYPE_DOM

#define CD_TYPE_DOM (cd_dom_get_type ())

struct CdDomClass

struct CdDomClass {
	GObjectClass		 parent_class;
};

CdDom

typedef struct _CdDom CdDom;