XbNode: libxmlb Reference Manual

## XbNode XbNode |

## Functions

gchar * | xb_node_export ()
GBytes * | xb_node_get_data ()
void | xb_node_set_data ()
XbNode * | xb_node_get_root ()
XbNode * | xb_node_get_parent ()
XbNode * | xb_node_get_next ()
XbNode * | xb_node_get_child ()
GPtrArray * | xb_node_get_children ()
const gchar * | xb_node_get_element ()
const gchar * | xb_node_get_text ()
guint64 | xb_node_get_text_as_uint ()
const gchar * | xb_node_get_attr ()
guint64 | xb_node_get_attr_as_uint ()
guint | xb_node_get_depth ()

## Types and Values

#define | XB_TYPE_NODE
struct | XbNodeClass
enum | XbNodeExportFlags
| XbNode

## Description

## Functions

### xb_node_export ()

    gchar *
    xb_node_export (XbNode *self,
                    XbNodeExportFlags flags,
                    GError **error);

Exports the node back to XML.

#### Parameters

self | a XbNode |
flags | some XbNodeExportFlags, e.g. XB_NODE_EXPORT_FLAG_NONE |
error | the GError, or `NULL` |

#### Returns

XML data, or `NULL` for an error

Since: 0.1.0

### xb_node_get_data ()

    GBytes *
    xb_node_get_data (XbNode *self,
                      const gchar *key);

Gets any data that has been set on the node using `xb_node_set_data()`.

#### Parameters

self | a XbNode |
key | a string key, e.g. `fwupd::RemoteId` |

#### Returns

a GBytes, or `NULL` if not found.

[transfer none]

Since: 0.1.0

### xb_node_set_data ()

    void
    xb_node_set_data (XbNode *self,
                      const gchar *key,
                      GBytes *data);

Sets some data on the node which can be retrieved using `xb_node_get_data()`.

#### Parameters

self | a XbNode |
key | a string key, e.g. `fwupd::RemoteId` |
data | a GBytes |

Since: 0.1.0

### xb_node_get_root ()

    XbNode *
    xb_node_get_root (XbNode *self);

Gets the root node for the node.

#### Parameters

self | a XbNode |

#### Returns

a XbNode, or `NULL`.

[transfer full]

Since: 0.1.0

### xb_node_get_parent ()

    XbNode *
    xb_node_get_parent (XbNode *self);

Gets the parent node for the current node.

#### Parameters

self | a XbNode |

#### Returns

a XbNode, or `NULL`.

[transfer full]

Since: 0.1.0

### xb_node_get_next ()

    XbNode *
    xb_node_get_next (XbNode *self);

Gets the next sibling node for the current node.

#### Parameters

self | a XbNode |

#### Returns

a XbNode, or `NULL`.

[transfer none]

Since: 0.1.0

### xb_node_get_child ()

    XbNode *
    xb_node_get_child (XbNode *self);

Gets the first child node for the current node.

#### Parameters

self | a XbNode |

#### Returns

a XbNode, or `NULL`.

[transfer none]

Since: 0.1.0

### xb_node_get_children ()

    GPtrArray *
    xb_node_get_children (XbNode *self);

Gets all the children for the current node.

#### Parameters

self | a XbNode |

#### Returns

an array of children.

[transfer container][element-type XbNode]

Since: 0.1.0

### xb_node_get_element ()

    const gchar *
    xb_node_get_element (XbNode *self);

Gets the element name for a specific node.

#### Parameters

self | a XbNode |

#### Returns

a string, or `NULL` for unset

Since: 0.1.0

### xb_node_get_text ()

    const gchar *
    xb_node_get_text (XbNode *self);

Gets the text data for a specific node.

#### Parameters

self | a XbNode |

#### Returns

a string, or `NULL` for unset

Since: 0.1.0

### xb_node_get_text_as_uint ()

    guint64
    xb_node_get_text_as_uint (XbNode *self);

Gets some attribute text data for a specific node.

#### Parameters

self | a XbNode |

#### Returns

a guint64, or `G_MAXUINT64` if unfound

Since: 0.1.0

### xb_node_get_attr ()

    const gchar *
    xb_node_get_attr (XbNode *self,
                      const gchar *name);

Gets some attribute text data for a specific node.

#### Parameters

self | a XbNode |
name | an attribute name, e.g. "type" |

#### Returns

a string, or `NULL` for unset

Since: 0.1.0

### xb_node_get_attr_as_uint ()

    guint64
    xb_node_get_attr_as_uint (XbNode *self,
                              const gchar *name);

Gets some attribute text data for a specific node.

#### Parameters

self | a XbNode |
name | an attribute name, e.g. `type` |

#### Returns

a guint64, or `G_MAXUINT64` if unfound

Since: 0.1.0

### xb_node_get_depth ()

    guint
    xb_node_get_depth (XbNode *self);

Gets the depth of the node to a root.

#### Parameters

self | a XbNode |

#### Returns

a integer, where 0 is the root node iself.

Since: 0.1.0

## Types and Values

### XB_TYPE_NODE

    #define             XB_TYPE_NODE

### struct XbNodeClass

    struct XbNodeClass {
    	GObjectClass			 parent_class;
    };

### enum XbNodeExportFlags

The flags for converting to XML.

#### Members

XB_NODE_EXPORT_FLAG_NONE |  |
XB_NODE_EXPORT_FLAG_ADD_HEADER |  |
XB_NODE_EXPORT_FLAG_FORMAT_MULTILINE |  |
XB_NODE_EXPORT_FLAG_FORMAT_INDENT |  |
XB_NODE_EXPORT_FLAG_INCLUDE_SIBLINGS |  |
XB_NODE_EXPORT_FLAG_ONLY_CHILDREN |  |

### XbNode

    typedef struct _XbNode XbNode;