GimpXmlParser

GimpXmlParser

Synopsis

                    GimpXmlParser;
GimpXmlParser *     gimp_xml_parser_new                 (const GMarkupParser *markup_parser,
                                                         gpointer user_data);
gboolean            gimp_xml_parser_parse_file          (GimpXmlParser *parser,
                                                         const gchar *filename,
                                                         GError **error);
gboolean            gimp_xml_parser_parse_fd            (GimpXmlParser *parser,
                                                         gint fd,
                                                         GError **error);
gboolean            gimp_xml_parser_parse_io_channel    (GimpXmlParser *parser,
                                                         GIOChannel *io,
                                                         GError **error);
gboolean            gimp_xml_parser_parse_buffer        (GimpXmlParser *parser,
                                                         const gchar *buffer,
                                                         gssize len,
                                                         GError **error);
void                gimp_xml_parser_free                (GimpXmlParser *parser);

Description

Details

GimpXmlParser

typedef struct _GimpXmlParser GimpXmlParser;


gimp_xml_parser_new ()

GimpXmlParser *     gimp_xml_parser_new                 (const GMarkupParser *markup_parser,
                                                         gpointer user_data);

GimpXmlParser is a thin wrapper around GMarkupParser. This function creates one for you and sets up a GMarkupParseContext.

markup_parser :

a GMarkupParser

user_data :

user data to pass to GMarkupParser functions

Returns :

a new GimpXmlParser

gimp_xml_parser_parse_file ()

gboolean            gimp_xml_parser_parse_file          (GimpXmlParser *parser,
                                                         const gchar *filename,
                                                         GError **error);

This function creates a GIOChannel for filename and calls gimp_xml_parser_parse_io_channel() for you.

parser :

a GimpXmlParser

filename :

name of a file to parse

error :

return location for possible errors

Returns :

TRUE on success, FALSE otherwise

gimp_xml_parser_parse_fd ()

gboolean            gimp_xml_parser_parse_fd            (GimpXmlParser *parser,
                                                         gint fd,
                                                         GError **error);

This function creates a GIOChannel for fd and calls gimp_xml_parser_parse_io_channel() for you.

parser :

a GimpXmlParser

fd :

a file descriptor

error :

return location for possible errors

Returns :

TRUE on success, FALSE otherwise

gimp_xml_parser_parse_io_channel ()

gboolean            gimp_xml_parser_parse_io_channel    (GimpXmlParser *parser,
                                                         GIOChannel *io,
                                                         GError **error);

Makes parser read from the specified io channel. This function returns when the GIOChannel becomes empty (end of file) or an error occurs, either reading from io or parsing the read data.

This function tries to determine the character encoding from the XML header and converts the content to UTF-8 for you. For this feature to work, the XML header with the encoding attribute must be contained in the first 4096 bytes read. Otherwise UTF-8 encoding will be assumed and parsing may break later if this assumption was wrong.

parser :

a GimpXmlParser

io :

a GIOChannel

error :

return location for possible errors

Returns :

TRUE on success, FALSE otherwise

gimp_xml_parser_parse_buffer ()

gboolean            gimp_xml_parser_parse_buffer        (GimpXmlParser *parser,
                                                         const gchar *buffer,
                                                         gssize len,
                                                         GError **error);

This function uses the given parser to parse the XML in buffer.

parser :

a GimpXmlParser

buffer :

a string buffer

len :

the number of byes in buffer or -1 if buffer is nul-terminated

error :

return location for possible errors

Returns :

TRUE on success, FALSE otherwise

gimp_xml_parser_free ()

void                gimp_xml_parser_free                (GimpXmlParser *parser);

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

parser :

a GimpXmlParser