## BWriter

BWriter — writes XML files

## Synopsis

    struct      BWriter;
    BWriter*    b_writer_new                    (FILE *stream,
                                                 gint indent);
    void        b_writer_free                   (BWriter *writer);
    void        b_write_header                  (BWriter *writer,
                                                 const gchar *encoding);
    void        b_write_open_tag                (BWriter *writer,
                                                 const gchar *tag,
                                                 ...);
    void        b_write_close_tag               (BWriter *writer,
                                                 const gchar *tag);
    void        b_write_element                 (BWriter *writer,
                                                 const gchar *tag,
                                                 const gchar *value,
                                                 ...);

## Description

## Details

### struct BWriter

    struct BWriter;

The BWriter struct is private.

### b_writer_new ()

    BWriter*    b_writer_new                    (FILE *stream,
                                                 gint indent);

Creates a new BWriter which gives a convenient interface to write XML data to `stream`. The writer should later be freed using b_writer_free().

`stream` : | a FILE stream prepared for writing
`indent` : | how many characters to indent per nesting level
Returns : | a newly allocate BWriter

### b_writer_free ()

    void        b_writer_free                   (BWriter *writer);

Frees the resources allocated for `writer`. You must not access `writer` after calling this function.

`writer` : | a BWriter

### b_write_header ()

    void        b_write_header                  (BWriter *writer,
                                                 const gchar *encoding);

Writes an XML header to the stream associated with `writer`.

`writer` : | a BWriter
`encoding` : | an optional encoding string or `NULL`

### b_write_open_tag ()

    void        b_write_open_tag                (BWriter *writer,
                                                 const gchar *tag,
                                                 ...);

Writes an opening XML tag with the element name `tag` to the stream associated with `writer`. You can pass a `NULL`-terminated list of key/value pairs that are written out as attributes.

`writer` : | a BWriter
`tag` : | the name of the element to open
`...` : | an optional key/value pairs interpreted as attributes

### b_write_close_tag ()

    void        b_write_close_tag               (BWriter *writer,
                                                 const gchar *tag);

Writes a closing XML tag with the element name `tag` to the stream associated with `writer`.

`writer` : | a BWriter
`tag` : | the name of the element to close

### b_write_element ()

    void        b_write_element                 (BWriter *writer,
                                                 const gchar *tag,
                                                 const gchar *value,
                                                 ...);

Writes an XML element with the name `tag` and the value `value` to the stream associated with `writer`. If `value` is `NULL`, an empty element is written. You can pass a `NULL`-terminated list of key/value pairs that are written out as attributes.

`writer` : | a BWriter
`tag` : | the element name
`value` : | the element value
`...` : | an optional key/value pairs interpreted as attributes