## XML Template Functions XML Template Functions — Functions to create and parse glabels XML template nodes and files |

## Functions

void | lgl_xml_template_read_templates_from_file ()
void | lgl_xml_template_parse_templates_doc ()
lglTemplate * | lgl_xml_template_parse_template_node ()
gint | lgl_xml_template_write_templates_to_file ()
gint | lgl_xml_template_write_template_to_file ()
void | lgl_xml_template_create_template_node ()

## Includes

    #include <libglabels/lgl-xml-templates.h>

## Description

This section describes a number of functions for creating and parsing glabels XML template nodes and files. Template nodes are used in both template files and document files.

## Functions

### lgl_xml_template_read_templates_from_file ()

    void
    lgl_xml_template_read_templates_from_file
                                   (const gchar *utf8_filename);

Read glabels templates from template file.

#### Parameters

utf8_filename | Filename of papers file (name encoded as UTF-8) |

### lgl_xml_template_parse_templates_doc ()

    void
    lgl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc);

Read glabels templates from a libxml xmlDocPtr tree.

#### Parameters

templates_doc | libxml xmlDocPtr tree, representing template file. |

### lgl_xml_template_parse_template_node ()

    lglTemplate *
    lgl_xml_template_parse_template_node (const xmlNodePtr template_node);

Read a single glabels template from a libxml xmlNodePtr node.

#### Parameters

template_node | libxml xmlNodePtr template node from a xmlDocPtr tree. |

#### Returns

a pointer to a newly created lglTemplate structure.

### lgl_xml_template_write_templates_to_file ()

    gint
    lgl_xml_template_write_templates_to_file
                                   (GList *templates,
                                    const gchar *utf8_filename);

Write a list of lglTemplate structures to a glabels XML template file.

#### Parameters

templates | List of lglTemplate structures |
utf8_filename | Filename of templates file (name encoded as UTF-8) |

#### Returns

the number of bytes written or -1 in case of failure

### lgl_xml_template_write_template_to_file ()

    gint
    lgl_xml_template_write_template_to_file
                                   (const lglTemplate *template,
                                    const gchar *utf8_filename);

Write a single lglTemplate structures to a glabels XML template file.

#### Parameters

template | lglTemplate structure to be written |
utf8_filename | Filename of templates file (name encoded as UTF-8) |

#### Returns

the number of bytes written or -1 in case of failure

### lgl_xml_template_create_template_node ()

    void
    lgl_xml_template_create_template_node (const lglTemplate *template,
                                           xmlNodePtr root,
                                           const xmlNsPtr ns);

Add a single lglTemplate child node to given xmlNodePtr.

#### Parameters

template | lglTemplate structure to be written |
root | parent node to receive new child node |
ns | a libxml xmlNsPtr |

## Types and Values