## Xml Utils

Xml Utils — An api to read and write xml.

## Functions

gboolean | glade_xml_load_sym_from_node ()
gchar * | glade_xml_dump_from_context ()
GList * | glade_xml_get_property_targetable_versions ()
gboolean | glade_xml_get_property_version ()
GladeXmlNode * | glade_xml_search_child ()
GladeXmlNode * | glade_xml_search_child_required ()
gchar * | glade_xml_get_content ()
void | glade_xml_set_content ()
gboolean | glade_xml_get_value_int ()
gboolean | glade_xml_get_value_int_required ()
gchar * | glade_xml_get_value_string ()
gchar * | glade_xml_get_value_string_required ()
gboolean | glade_xml_get_boolean ()
void | glade_xml_set_value ()
gchar * | glade_xml_get_property_string_required ()
gchar * | glade_xml_get_property_string ()
gboolean | glade_xml_get_property_boolean ()
gdouble | glade_xml_get_property_double ()
gint | glade_xml_get_property_int ()
void | glade_xml_node_set_property_string ()
void | glade_xml_node_set_property_boolean ()
GladeXmlNode * | glade_xml_node_new ()
GladeXmlNode * | glade_xml_node_new_comment ()
GladeXmlNode * | glade_xml_node_copy ()
void | glade_xml_node_delete ()
GladeXmlNode * | glade_xml_node_get_children ()
GladeXmlNode * | glade_xml_node_next ()
gboolean | glade_xml_node_verify ()
gboolean | glade_xml_node_verify_silent ()
const gchar * | glade_xml_node_get_name ()
GladeXmlNode * | glade_xml_node_get_parent ()
void | glade_xml_node_append_child ()
void | glade_xml_node_remove ()
gboolean | glade_xml_node_is_comment ()
GladeXmlNode * | glade_xml_node_next_with_comments ()
GladeXmlNode * | glade_xml_node_get_children_with_comments ()
GladeXmlNode * | glade_xml_node_add_next_sibling ()
GladeXmlNode * | glade_xml_node_add_prev_sibling ()
GladeXmlNode * | glade_xml_node_prev_with_comments ()
GladeXmlDoc * | glade_xml_doc_new ()
GladeXmlNode * | glade_xml_doc_new_comment ()
GladeXmlDoc * | glade_xml_doc_ref ()
void | glade_xml_doc_unref ()
GladeXmlNode * | glade_xml_doc_get_root ()
void | glade_xml_doc_set_root ()
gint | glade_xml_doc_save ()
GladeXmlContext * | glade_xml_context_new ()
GladeXmlContext * | glade_xml_context_copy ()
void | glade_xml_context_free ()
GladeXmlContext * | glade_xml_context_new_from_path ()
GladeXmlDoc * | glade_xml_context_get_doc ()

## Types and Values

| GladeXmlContext
| GladeXmlNode
| GladeXmlDoc

## Description

You may need these tools if you are implementing GladeReadWidgetFunc and/or GladeWriteWidgetFunc on your GladeWidgetAdaptor to read and write widgets in custom ways

## Functions

### glade_xml_load_sym_from_node ()

    gboolean
    glade_xml_load_sym_from_node (GladeXmlNode *node_in,
                                  GModule *module,
                                  gchar *tagname,
                                  gpointer *sym_location);

### glade_xml_dump_from_context ()

    gchar *
    glade_xml_dump_from_context (GladeXmlContext *context);

Dump the XML string from the context.

#### Parameters

context | a GladeXmlContext |

#### Returns

the XML string, free the allocated memory with `g_free()` after use

### glade_xml_get_property_targetable_versions ()

    GList *
    glade_xml_get_property_targetable_versions
                                   (GladeXmlNode *node_in,
                                    const gchar *name);

Get the list of targetable versions for a property

#### Parameters

node_in | a GladeXmlNode |
name | a property name |

#### Returns

a list of GladeTargetableVersion.

[element-type GladeTargetableVersion][transfer full]

### glade_xml_get_property_version ()

    gboolean
    glade_xml_get_property_version (GladeXmlNode *node_in,
                                    const gchar *name,
                                    guint16 *major,
                                    guint16 *minor);

### glade_xml_search_child ()

    GladeXmlNode *
    glade_xml_search_child (GladeXmlNode *node,
                            const gchar *name);

### glade_xml_search_child_required ()

    GladeXmlNode *
    glade_xml_search_child_required (GladeXmlNode *tree,
                                     const gchar *name);

just a small wrapper around glade_xml_search_child that displays an error if the child was not found

#### Parameters

tree | A GladeXmlNode |
name | the name of the child |

#### Returns

the requested GladeXmlNode.

[nullable]

### glade_xml_get_content ()

    gchar *
    glade_xml_get_content (GladeXmlNode *node_in);

Gets a string containing the content of `node_in` .

#### Parameters

node_in | a GladeXmlNode |

#### Returns

A newly allocated string

### glade_xml_set_content ()

    void
    glade_xml_set_content (GladeXmlNode *node_in,
                           const gchar *content);

Sets the content of `node` to `content` .

#### Parameters

node_in | a GladeXmlNode |
content | a string |

### glade_xml_get_value_int ()

    gboolean
    glade_xml_get_value_int (GladeXmlNode *node_in,
                             const gchar *name,
                             int *val);

Gets an integer value for a node either carried as an attribute or as the content of a child.

#### Parameters

node_in | a GladeXmlNode |
name | a string |
val | a pointer to an int |

#### Returns

`TRUE` if the node is found, `FALSE` otherwise

### glade_xml_get_value_int_required ()

    gboolean
    glade_xml_get_value_int_required (GladeXmlNode *node,
                                      const gchar *name,
                                      int *val);

This is a wrapper around `glade_xml_get_value_int()`, only it emits a `g_warning()` if `node` did not contain the requested tag

#### Parameters

node | a GladeXmlNode |
name | a string |
val | a pointer to an int |

#### Returns

`FALSE` if `name` is not in `node`

### glade_xml_get_value_string ()

    gchar *
    glade_xml_get_value_string (GladeXmlNode *node,
                                const gchar *name);

### glade_xml_get_value_string_required ()

    gchar *
    glade_xml_get_value_string_required (GladeXmlNode *node,
                                         const gchar *name,
                                         const gchar *xtra_info);

### glade_xml_get_boolean ()

    gboolean
    glade_xml_get_boolean (GladeXmlNode *node,
                           const gchar *name,
                           gboolean _default);

### glade_xml_set_value ()

    void
    glade_xml_set_value (GladeXmlNode *node_in,
                         const gchar *name,
                         const gchar *val);

Sets the property `name` in `node_in` to `val`

#### Parameters

node_in | a GladeXmlNode |
name | a string |
val | a string |

### glade_xml_get_property_string_required ()

    gchar *
    glade_xml_get_property_string_required
                                   (GladeXmlNode *node_in,
                                    const gchar *name,
                                    const gchar *xtra);

### glade_xml_get_property_string ()

    gchar *
    glade_xml_get_property_string (GladeXmlNode *node_in,
                                   const gchar *name);

### glade_xml_get_property_boolean ()

    gboolean
    glade_xml_get_property_boolean (GladeXmlNode *node_in,
                                    const gchar *name,
                                    gboolean _default);

### glade_xml_get_property_double ()

    gdouble
    glade_xml_get_property_double (GladeXmlNode *node_in,
                                   const gchar *name,
                                   gdouble _default);

### glade_xml_get_property_int ()

    gint
    glade_xml_get_property_int (GladeXmlNode *node_in,
                                const gchar *name,
                                gint _default);

### glade_xml_node_set_property_string ()

    void
    glade_xml_node_set_property_string (GladeXmlNode *node_in,
                                        const gchar *name,
                                        const gchar *string);

Set a property as a string in the `node_in` . Note that `NULL` `string` value Are simply ignored and not written in the XML.

#### Parameters

node_in | a GladeXmlNode |
name | the name of the property to set |
string | the string value of the property to set. | [nullable]

### glade_xml_node_set_property_boolean ()

    void
    glade_xml_node_set_property_boolean (GladeXmlNode *node_in,
                                         const gchar *name,
                                         gboolean value);

### glade_xml_node_new ()

    GladeXmlNode *
    glade_xml_node_new (GladeXmlContext *context,
                        const gchar *name);

### glade_xml_node_new_comment ()

    GladeXmlNode *
    glade_xml_node_new_comment (GladeXmlContext *context,
                                const gchar *comment);

### glade_xml_node_copy ()

    GladeXmlNode *
    glade_xml_node_copy (GladeXmlNode *node);

### glade_xml_node_delete ()

    void
    glade_xml_node_delete (GladeXmlNode *node);

### glade_xml_node_get_children ()

    GladeXmlNode *
    glade_xml_node_get_children (GladeXmlNode *node);

### glade_xml_node_next ()

    GladeXmlNode *
    glade_xml_node_next (GladeXmlNode *node_in);

### glade_xml_node_verify ()

    gboolean
    glade_xml_node_verify (GladeXmlNode *node_in,
                           const gchar *name);

This is a wrapper around `glade_xml_node_verify_silent()`, only it emits a `g_warning()` if `node_in` has a name different than `name` .

#### Parameters

node_in | a GladeXmlNode |
name | a string |

#### Returns

`TRUE` if `node_in` 's name is equal to `name` , `FALSE` otherwise

### glade_xml_node_verify_silent ()

    gboolean
    glade_xml_node_verify_silent (GladeXmlNode *node_in,
                                  const gchar *name);

#### Parameters

node_in | a GladeXmlNode |
name | a string |

#### Returns

`TRUE` if `node_in` 's name is equal to `name` , `FALSE` otherwise

### glade_xml_node_get_name ()

    const gchar *
    glade_xml_node_get_name (GladeXmlNode *node_in);

### glade_xml_node_get_parent ()

    GladeXmlNode *
    glade_xml_node_get_parent (GladeXmlNode *node_in);

### glade_xml_node_append_child ()

    void
    glade_xml_node_append_child (GladeXmlNode *node,
                                 GladeXmlNode *child);

### glade_xml_node_remove ()

    void
    glade_xml_node_remove (GladeXmlNode *node_in);

### glade_xml_node_is_comment ()

    gboolean
    glade_xml_node_is_comment (GladeXmlNode *node_in);

### glade_xml_node_next_with_comments ()

    GladeXmlNode *
    glade_xml_node_next_with_comments (GladeXmlNode *node_in);

### glade_xml_node_get_children_with_comments ()

    GladeXmlNode *
    glade_xml_node_get_children_with_comments
                                   (GladeXmlNode *node);

### glade_xml_node_add_next_sibling ()

    GladeXmlNode *
    glade_xml_node_add_next_sibling (GladeXmlNode *node,
                                     GladeXmlNode *new_node);

### glade_xml_node_add_prev_sibling ()

    GladeXmlNode *
    glade_xml_node_add_prev_sibling (GladeXmlNode *node,
                                     GladeXmlNode *new_node);

### glade_xml_node_prev_with_comments ()

    GladeXmlNode *
    glade_xml_node_prev_with_comments (GladeXmlNode *node_in);

### glade_xml_doc_new ()

    GladeXmlDoc *
    glade_xml_doc_new (void);

Creates a new GladeXmlDoc.

#### Returns

a new GladeXmlDoc.

[transfer full]

### glade_xml_doc_new_comment ()

    GladeXmlNode *
    glade_xml_doc_new_comment (GladeXmlDoc *doc,
                               const gchar *comment);

### glade_xml_doc_ref ()

    GladeXmlDoc *
    glade_xml_doc_ref (GladeXmlDoc *doc);

Increases the reference of the GladeXmlDoc.

#### Parameters

doc | a GladeXmlDoc |

#### Returns

the given GladeXmlDoc.

[transfer full]

### glade_xml_doc_unref ()

    void
    glade_xml_doc_unref (GladeXmlDoc *doc);

Decreases the reference of the GladeXmlDoc.

#### Parameters

doc | a GladeXmlDoc |

### glade_xml_doc_get_root ()

    GladeXmlNode *
    glade_xml_doc_get_root (GladeXmlDoc *doc);

#### Parameters

doc | a GladeXmlDoc |

#### Returns

the GladeXmlNode that is the document root of `doc` .

[transfer none]

### glade_xml_doc_set_root ()

    void
    glade_xml_doc_set_root (GladeXmlDoc *doc,
                            GladeXmlNode *node);

### glade_xml_doc_save ()

    gint
    glade_xml_doc_save (GladeXmlDoc *doc_in,
                        const gchar *full_path);

### glade_xml_context_new ()

    GladeXmlContext *
    glade_xml_context_new (GladeXmlDoc *doc,
                           const gchar *name_space);

#### Parameters

doc | a GladeXmlDoc. | [transfer full]
name_space | unused argument. | [nullable]

#### Returns

a new GladeXmlContext.

[transfer full]

### glade_xml_context_copy ()

    GladeXmlContext *
    glade_xml_context_copy (GladeXmlContext *context);

#### Parameters

context | a GladeXmlDoc |

#### Returns

a copy of the given GladeXmlContext.

[transfer full]

### glade_xml_context_free ()

    void
    glade_xml_context_free (GladeXmlContext *context);

Frees the memory allocated by GladeXmlContext.

#### Parameters

context | An GladeXmlContext |

### glade_xml_context_new_from_path ()

    GladeXmlContext *
    glade_xml_context_new_from_path (const gchar *full_path,
                                     const gchar *nspace,
                                     const gchar *root_name);

Creates a new GladeXmlContext from the given path.

#### Parameters

full_path | the path to the XML file |
nspace | the expected namespace. | [nullable]
root_name | the expected root name. | [nullable]

#### Returns

a new GladeXmlContext or `NULL` on failure.

[transfer full][nullable]

### glade_xml_context_get_doc ()

    GladeXmlDoc *
    glade_xml_context_get_doc (GladeXmlContext *context);

Get the GladeXmlDoc this `context` refers to.

#### Parameters

context | a GladeXmlContext |

#### Returns

the GladeXmlDoc that the `context` refers to.

[transfer none]

## Types and Values

### GladeXmlContext

    typedef struct _GladeXmlContext GladeXmlContext;

### GladeXmlNode

    typedef struct _GladeXmlNode GladeXmlNode;

### GladeXmlDoc

    typedef struct _GladeXmlDoc GladeXmlDoc;