## ibusxml ibusxml — XML handling functions for IBus. |

## Stability Level

Stable, unless otherwise indicated

## Functions

XMLNode * | ibus_xml_copy ()
XMLNode * | ibus_xml_parse_file ()
XMLNode * | ibus_xml_parse_buffer ()
void | ibus_xml_free ()
void | ibus_xml_output ()

## Types and Values

| IBusXML
#define | XMLNode

## Description

IBusXML lists data structure and handling function for XML in IBus.

## Functions

### ibus_xml_copy ()

    XMLNode *
    ibus_xml_copy (const XMLNode *node);

Creates a copy of `node` , which should be freed with `ibus_xml_free()`. Primarily used by language bindings, not that useful otherwise (since `node` can just be copied by assignment in C).

#### Parameters

node | Root node of an XML tree. |

#### Returns

the newly allocated IBusXML, which should be freed with `ibus_xml_free()`, or `NULL` if `node` was `NULL`.

### ibus_xml_parse_file ()

    XMLNode *
    ibus_xml_parse_file (const gchar *name);

Parse an XML file and return a corresponding XML tree.

#### Parameters

name | File name to be parsed. |

#### Returns

Root node of parsed XML tree.

### ibus_xml_parse_buffer ()

    XMLNode *
    ibus_xml_parse_buffer (const gchar *buffer);

Parse a string buffer which contains an XML-formatted string, and return a corresponding XML tree.

#### Parameters

buffer | Buffer to be parsed. |

#### Returns

Root node of parsed XML tree.

### ibus_xml_free ()

    void
    ibus_xml_free (XMLNode *node);

Free an XML tree.

#### Parameters

node | Root node of an XML tree. |

### ibus_xml_output ()

    void
    ibus_xml_output (const XMLNode *node,
                     GString *output);

Output an XML tree to a GString.

#### Parameters

node | Root node of an XML tree. |
output | GString which stores the output. |

## Types and Values

### IBusXML

    typedef struct {
        gchar  *name;
        gchar  *text;
        gchar  **attributes;
        GList *sub_nodes;
    } IBusXML;

A data type representing an XML node.

#### Members

gchar *`name`; | Name of XML tag. |
gchar *`text`; | Text enclosed by XML start tag and end tag. i.e. `text`. |
gchar **`attributes`; | Attributes of the XML node. |
GList *`sub_nodes`; | Children node of this XML node. |

### XMLNode

    #define XMLNode IBusXML