xb-node-query: libxmlb Reference Manual

## xb-node-query xb-node-query |

## Functions

GPtrArray * | xb_node_query ()
GPtrArray * | xb_node_query_full ()
XbNode * | xb_node_query_first ()
const gchar * | xb_node_query_text ()
guint64 | xb_node_query_text_as_uint ()
const gchar * | xb_node_query_attr ()
guint64 | xb_node_query_attr_as_uint ()
gchar * | xb_node_query_export ()

## Description

## Functions

### xb_node_query ()

    GPtrArray *
    xb_node_query (XbNode *self,
                   const gchar *xpath,
                   guint limit,
                   GError **error);

Searches the silo using an XPath query, returning up to `limit` results.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
xpath | an XPath, e.g. `id[abe.desktop]` |
limit | maximum number of results to return, or 0 for "all" |
error | the GError, or `NULL` |

#### Returns

results, or `NULL` if unfound.

[transfer container][element-type XbNode]

Since: 0.1.0

### xb_node_query_full ()

    GPtrArray *
    xb_node_query_full (XbNode *self,
                        XbQuery *query,
                        GError **error);

Searches the silo using an prepared query.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
query | an XbQuery |
error | the GError, or `NULL` |

#### Returns

results, or `NULL` if unfound.

[transfer container][element-type XbNode]

Since: 0.1.4

### xb_node_query_first ()

    XbNode *
    xb_node_query_first (XbNode *self,
                         const gchar *xpath,
                         GError **error);

Searches the node using an XPath query, returning up to one result.

Please note: Only a tiny subset of XPath 1.0 is supported.

#### Parameters

self | a XbNode |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
error | the GError, or `NULL` |

#### Returns

a XbNode, or `NULL` if unfound.

[transfer full]

Since: 0.1.0

### xb_node_query_text ()

    const gchar *
    xb_node_query_text (XbNode *self,
                        const gchar *xpath,
                        GError **error);

Searches the node using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
error | the GError, or `NULL` |

#### Returns

a string, or `NULL` if unfound.

[transfer none]

Since: 0.1.0

### xb_node_query_text_as_uint ()

    guint64
    xb_node_query_text_as_uint (XbNode *self,
                                const gchar *xpath,
                                GError **error);

Searches the node using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
error | the GError, or `NULL` |

#### Returns

a guint64, or `G_MAXUINT64` if unfound

Since: 0.1.0

### xb_node_query_attr ()

    const gchar *
    xb_node_query_attr (XbNode *self,
                        const gchar *xpath,
                        const gchar *name,
                        GError **error);

Searches the node using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
name | an attribute name, e.g. `type` |
error | the GError, or `NULL` |

#### Returns

a string, or `NULL` if unfound.

[transfer none]

Since: 0.1.0

### xb_node_query_attr_as_uint ()

    guint64
    xb_node_query_attr_as_uint (XbNode *self,
                                const gchar *xpath,
                                const gchar *name,
                                GError **error);

Searches the node using an XPath query, returning up to one result.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
name | an attribute name, e.g. `type` |
error | the GError, or `NULL` |

#### Returns

a guint64, or `G_MAXUINT64` if unfound

Since: 0.1.0

### xb_node_query_export ()

    gchar *
    xb_node_query_export (XbNode *self,
                          const gchar *xpath,
                          GError **error);

Searches the node using an XPath query, returning an XML string of the result and any children.

It is safe to call this function from a different thread to the one that created the XbSilo.

Please note: Only a subset of XPath is supported.

#### Parameters

self | a XbNode |
xpath | An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` |
error | the GError, or `NULL` |

#### Returns

a string, or `NULL` if unfound.

[transfer none]

Since: 0.1.0

## Types and Values