LibXML extras: GOffice Reference Manual

## LibXML extras LibXML extras |

## Functions

xmlNode * | go_xml_get_child_by_name ()
xmlNode * | go_xml_get_child_by_name_by_lang ()
xmlNode * | go_xml_get_child_by_name_no_lang ()
void | go_xml_in_doc_dispose_on_exit ()
gboolean | go_xml_node_get_bool ()
xmlChar * | go_xml_node_get_cstr ()
gboolean | go_xml_node_get_double ()
gboolean | go_xml_node_get_enum ()
gboolean | go_xml_node_get_gocolor ()
gboolean | go_xml_node_get_int ()
void | go_xml_node_set_bool ()
void | go_xml_node_set_cstr ()
void | go_xml_node_set_double ()
void | go_xml_node_set_enum ()
void | go_xml_node_set_gocolor ()
void | go_xml_node_set_int ()
void | go_xml_out_add_color ()
void | go_xml_out_add_double ()
void | go_xml_out_add_long_double ()
void | go_xml_out_add_decimal64 ()
xmlDocPtr | go_xml_parse_file ()

## Description

## Functions

### go_xml_get_child_by_name ()

    xmlNode *
    go_xml_get_child_by_name (xmlNode const *parent,
                              char const *child_name);

Find the child with `child_name` as name.

[skip]

#### Parameters

parent | xmlNode |
child_name | child name |

#### Returns

the child with `child_name` as name if any.

[transfer none][nullable]

### go_xml_get_child_by_name_by_lang ()

    xmlNode *
    go_xml_get_child_by_name_by_lang (xmlNode const *parent,
                                      char const *child_name);

Find the child with `child_name` as name and with "xml:lang" attribute corresponding to the preferred language.

[skip]

#### Parameters

parent | xmlNode |
child_name | child name |

#### Returns

the child with `child_name` as name and with "xml:lang" attribute corresponding to the preferred language.

[transfer none][nullable]

### go_xml_get_child_by_name_no_lang ()

    xmlNode *
    go_xml_get_child_by_name_no_lang (xmlNode const *parent,
                                      char const *child_name);

Find the child with `child_name` as name and without "xml:lang" attribute.

[skip]

#### Parameters

parent | xmlNode |
child_name | child name |

#### Returns

the child with `child_name` as name and without "xml:lang" attribute if any.

[transfer none][nullable]

### go_xml_in_doc_dispose_on_exit ()

    void
    go_xml_in_doc_dispose_on_exit (GsfXMLInDoc **pdoc);

Registers `pdoc` to be freed on exit.

[skip]

#### Parameters

pdoc | location of GsfXMLInDoc pointer |

### go_xml_node_get_bool ()

    gboolean
    go_xml_node_get_bool (xmlNodePtr node,
                          char const *name,
                          gboolean *result);

Reads a boolean value from the attribute `name` of `node` , or from the content of `node` if `name` is `NULL`.

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
result | boolean result. | [out]

#### Returns

`TRUE` if a value was found.

### go_xml_node_get_cstr ()

    xmlChar *
    go_xml_node_get_cstr (xmlNodePtr node,
                          char const *name);

Get an xmlChar * value for a node carried as an attribute. result must be xmlFree.

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]

#### Returns

the attribute value.

[transfer full][nullable]

### go_xml_node_get_double ()

    gboolean
    go_xml_node_get_double (xmlNodePtr node,
                            char const *name,
                            double *result);

Reads a double value from the attribute `name` of `node` , or from the content of `node` if `name` is `NULL`.

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
result | double result. | [out]

#### Returns

`TRUE` if a value was found.

### go_xml_node_get_enum ()

    gboolean
    go_xml_node_get_enum (xmlNodePtr node,
                          char const *name,
                          GType etype,
                          gint *result);

Reads an enum value from the attribute `name` of `node` , or from the content of `node` if `name` is `NULL`.

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
etype | GType |
result | enum result. | [out]

#### Returns

`TRUE` if a value was found.

### go_xml_node_get_gocolor ()

    gboolean
    go_xml_node_get_gocolor (xmlNodePtr node,
                             char const *name,
                             GOColor *result);

Reads a color value from the attribute `name` of `node` , or from the content of `node` if `name` is `NULL`.

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
result | color result. | [out]

#### Returns

`TRUE` if a value was found.

### go_xml_node_get_int ()

    gboolean
    go_xml_node_get_int (xmlNodePtr node,
                         char const *name,
                         int *result);

Reads an integer value from the attribute `name` of `node` , or from the content of `node` if `name` is `NULL`.

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
result | integer result. | [out]

#### Returns

`TRUE` if a value was found.

### go_xml_node_set_bool ()

    void
    go_xml_node_set_bool (xmlNodePtr node,
                          char const *name,
                          gboolean val);

Sets the attribute `name` of `node` to `val` as a boolean. If `name` is `NULL`, sets the content of `node` to `val` .

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
val | boolean value |

### go_xml_node_set_cstr ()

    void
    go_xml_node_set_cstr (xmlNodePtr node,
                          char const *name,
                          char const *val);

Sets the attribute `name` of `node` to `val` . If `name` is `NULL`, sets the content of `node` to `val` .

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
val | value. | [nullable]

### go_xml_node_set_double ()

    void
    go_xml_node_set_double (xmlNodePtr node,
                            char const *name,
                            double val,
                            int precision);

Sets the attribute `name` of `node` to `val` as a double. If `name` is `NULL`, sets the content of `node` to `val` .

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
val | double value |
precision | precision |

### go_xml_node_set_enum ()

    void
    go_xml_node_set_enum (xmlNodePtr node,
                          char const *name,
                          GType etype,
                          gint val);

Sets the attribute `name` of `node` to `val` as an enum. If `name` is `NULL`, sets the content of `node` to `val` .

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
etype | GType |
val | enum value |

### go_xml_node_set_gocolor ()

    void
    go_xml_node_set_gocolor (xmlNodePtr node,
                             char const *name,
                             GOColor val);

Sets the attribute `name` of `node` to `val` as a color. If `name` is `NULL`, sets the content of `node` to `val` .

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
val | color value |

### go_xml_node_set_int ()

    void
    go_xml_node_set_int (xmlNodePtr node,
                         char const *name,
                         int val);

Sets the attribute `name` of `node` to `val` as an integer. If `name` is `NULL`, sets the content of `node` to `val` .

[skip]

#### Parameters

node | xmlNodePtr |
name | attribute name. | [nullable]
val | integer value |

### go_xml_out_add_color ()

    void
    go_xml_out_add_color (GsfXMLOut *output,
                          char const *id,
                          GOColor c);

Output a representation of `c` .

#### Parameters

output | destination |
id | attribute name. | [allow-none]
c | color |

### go_xml_out_add_double ()

    void
    go_xml_out_add_double (GsfXMLOut *output,
                           char const *id,
                           double d);

Output a representation of `d` that will be read back without loss of precision.

#### Parameters

output | destination |
id | attribute name. | [allow-none]
d | value |

### go_xml_out_add_long_double ()

    void
    go_xml_out_add_long_double (GsfXMLOut *output,
                                char const *id,
                                long double ld);

Output a representation of `ld` that will be read back without loss of precision.

#### Parameters

output | destination |
id | attribute name. | [allow-none]
ld | value |

### go_xml_out_add_decimal64 ()

    void
    go_xml_out_add_decimal64 (GsfXMLOut *output,
                              char const *id,
                              _Decimal64 d);

Output a representation of `d` that will be read back without loss of precision.

#### Parameters

output | destination |
id | attribute name. | [allow-none]
d | value |

### go_xml_parse_file ()

    xmlDocPtr
    go_xml_parse_file (const char *filename);

Like xmlParseFile, but faster. Does not accept compressed files. See http://bugzilla.gnome.org/show_bug.cgi?id=168414

Note: this reads the entire file into memory and should therefore not be used for user-supplied files.

[skip]

#### Parameters

filename | the locale path to a file to parse. |

#### Returns

A libxml2 xmlDocPtr or `NULL`.

[transfer full][nullable]