glib-Simple-XML-Subset-Parser.html   [plain text]


<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Simple XML Subset Parser</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-utilities.html" title="GLib Utilities"><link rel="previous" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="next" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="refentry" href="glib-building.html" title="Compiling the GLib package"><link rel="refentry" href="glib-cross-compiling.html" title="Cross-compiling the GLib package"><link rel="refentry" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="refentry" href="glib-running.html" title="Running GLib Applications"><link rel="refentry" href="glib-changes.html" title="Changes to GLib"><link rel="refentry" href="glib-resources.html" title="Mailing lists and bug reports"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="refentry" href="glib-Basic-Types.html" title="Basic Types"><link rel="refentry" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="refentry" href="glib-Standard-Macros.html" title="Standard Macros"><link rel="refentry" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><link rel="refentry" href="glib-Byte-Order-Macros.html" title="Byte Order Macros"><link rel="refentry" href="glib-Numerical-Definitions.html" title="Numerical Definitions"><link rel="refentry" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros"><link rel="refentry" href="glib-Atomic-Operations.html" title="Atomic Operations"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="refentry" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop"><link rel="refentry" href="glib-Threads.html" title="
Threads"><link rel="refentry" href="glib-Thread-Pools.html" title="Thread Pools"><link rel="refentry" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues"><link rel="refentry" href="glib-Dynamic-Loading-of-Modules.html" title="Dynamic Loading of Modules"><link rel="refentry" href="glib-Memory-Allocation.html" title="Memory Allocation"><link rel="refentry" href="glib-IO-Channels.html" title="IO Channels"><link rel="refentry" href="glib-Error-Reporting.html" title="Error Reporting"><link rel="refentry" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><link rel="refentry" href="glib-Message-Logging.html" title="Message Logging"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="refentry" href="glib-String-Utility-Functions.html" title="String Utility Functions"><link rel="refentry" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"><link rel="refentry" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation"><link rel="refentry" href="glib-I18N.html" title="Internationalization"><link rel="refentry" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions"><link rel="refentry" href="glib-Random-Numbers.html" title="Random Numbers"><link rel="refentry" href="glib-Hook-Functions.html" title="Hook Functions"><link rel="refentry" href="glib-Miscellaneous-Utility-Functions.html" title="Miscellaneous Utility Functions"><link rel="refentry" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="refentry" href="glib-Automatic-String-Completion.html" title="Automatic String Completion"><link rel="refentry" href="glib-Timers.html" title="Timers"><link rel="refentry" href="glib-Spawning-Processes.html" title="Spawning Processes"><link rel="refentry" href="glib-File-Utilities.html" title="File Utilities"><link rel="refentry" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities"><link rel="refentry" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="refentry" href="glib-Simple-XML-Subset-Parser.html" title="Simple XML Subset Parser"><link rel="refentry" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="refentry" href="glib-Memory-Chunks.html" title="Memory Chunks"><link rel="refentry" href="glib-Doubly-Linked-Lists.html" title="Doubly-Linked Lists"><link rel="refentry" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists"><link rel="refentry" href="glib-Double-ended-Queues.html" title="Double-ended Queues"><link rel="refentry" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="refentry" href="glib-Hash-Tables.html" title="Hash Tables"><link rel="refentry" href="glib-Strings.html" title="Strings"><link rel="refentry" href="glib-String-Chunks.html" title="String Chunks"><link rel="refentry" href="glib-Arrays.html" title="Arrays"><link rel="refentry" href="glib-Pointer-Arrays.html" title="Pointer Arrays"><link rel="refentry" href="glib-Byte-Arrays.html" title="Byte Arrays"><link rel="refentry" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="refentry" href="glib-N-ary-Trees.html" title="N-ary Trees"><link rel="refentry" href="glib-Quarks.html" title="Quarks"><link rel="refentry" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists"><link rel="refentry" href="glib-Datasets.html" title="Datasets"><link rel="refentry" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="refentry" href="glib-Caches.html" title="Caches"><link rel="refentry" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="refentry" href="glib-gettextize.html" title="glib-gettextize"><link rel="index" href="ix01.html" title="Index"><link rel="section" href="glib-Simple-XML-Subset-Parser.html#id3223134" title="Description"><link rel="section" href="glib-Simple-XML-Subset-Parser.html#id3223244" title="Details"><meta name="generator" content="GTK-Doc V1.2 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Glob-style-pattern-matching.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-Windows-Compatability-Functions.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-Simple-XML-Subset-Parser"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">Simple XML Subset Parser</span></h2><p>Simple XML Subset Parser &#8212; parses a subset of XML.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">

#include &lt;glib.h&gt;


enum        <a href="glib-Simple-XML-Subset-Parser.html#GMarkupError">GMarkupError</a>;
#define     <a href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-CAPS">G_MARKUP_ERROR</a>
enum        <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags">GMarkupParseFlags</a>;
struct      <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a>;
struct      <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser">GMarkupParser</a>;
<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text">g_markup_escape_text</a>            (const <a href="glib-Basic-Types.html#gchar">gchar</a> *text,
                                             <a href="glib-Basic-Types.html#gssize">gssize</a> length);
<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Simple-XML-Subset-Parser.html#g-markup-printf-escaped">g_markup_printf_escaped</a>         (const char *format,
                                             ...);
<a href="glib-Basic-Types.html#gchar">gchar</a>*      <a href="glib-Simple-XML-Subset-Parser.html#g-markup-vprintf-escaped">g_markup_vprintf_escaped</a>        (const char *format,
                                             va_list args);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-end-parse">g_markup_parse_context_end_parse</a>
                                            (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);
void        <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-free">g_markup_parse_context_free</a>     (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);
void        <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-position">g_markup_parse_context_get_position</a>
                                            (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context,
                                             <a href="glib-Basic-Types.html#gint">gint</a> *line_number,
                                             <a href="glib-Basic-Types.html#gint">gint</a> *char_number);
G_CONST_RETURN <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element">g_markup_parse_context_get_element</a>
                                            (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);
<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a>* <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-new">g_markup_parse_context_new</a>
                                            (const <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser">GMarkupParser</a> *parser,
                                             <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags">GMarkupParseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data,
                                             <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> user_data_dnotify);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse">g_markup_parse_context_parse</a>    (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *text,
                                             <a href="glib-Basic-Types.html#gssize">gssize</a> text_len,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);

</pre></div><div class="refsect1" lang="en"><a name="id3223134"></a><h2>Description</h2><p>
The "GMarkup" parser is intended to parse a simple markup format
that's a subset of XML. This is a small, efficient, easy-to-use
parser. It should not be used if you expect to interoperate with other 
applications generating full-scale XML. However, it's very useful for
application data files, config files, etc. where you know your
application will be the only one writing the file. Full-scale XML
parsers should be able to parse the subset used by GMarkup, so you can
easily migrate to full-scale XML at a later time if the need arises.
</p><p>
GMarkup is not guaranteed to signal an error on all invalid XML; the
parser may accept documents that an XML parser would not. However, invalid XML 
documents are not considered valid GMarkup documents. 
</p><p>
Simplifications to XML include:
</p><div class="itemizedlist"><ul type="disc"><li><p>
Only UTF-8 encoding is allowed.
</p></li><li><p>
No user-defined entities.
</p></li><li><p>
Processing instructions, comments and the doctype declaration are "passed through" but are not 
interpreted in any way.
</p></li><li><p>
No DTD or validation.
</p></li></ul></div><p>
</p><p>
The markup format does support:
</p><div class="itemizedlist"><ul type="disc"><li><p>
Elements
</p></li><li><p>
Attributes
</p></li><li><p>
5 standard entities: <tt class="literal">&amp;amp; &amp;lt; &amp;gt; &amp;quot; &amp;apos;</tt>
</p></li><li><p>
Character references
</p></li><li><p>
Sections marked as CDATA
</p></li></ul></div><p>
</p></div><div class="refsect1" lang="en"><a name="id3223244"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3223249"></a><h3><a name="GMarkupError"></a>enum GMarkupError</h3><a class="indexterm" name="id3223260"></a><pre class="programlisting">typedef enum
{
  G_MARKUP_ERROR_BAD_UTF8,
  G_MARKUP_ERROR_EMPTY,
  G_MARKUP_ERROR_PARSE,
  /* These three are primarily intended for specific GMarkupParser
   * implementations to set.
   */
  G_MARKUP_ERROR_UNKNOWN_ELEMENT,
  G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
  G_MARKUP_ERROR_INVALID_CONTENT
} GMarkupError;
</pre><p>
Error codes returned by markup parsing.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">G_MARKUP_ERROR_BAD_UTF8</tt></span></td><td>text being parsed was not valid UTF-8
</td></tr><tr><td><span class="term"><tt class="literal">G_MARKUP_ERROR_EMPTY</tt></span></td><td>document contained nothing, or only whitespace
</td></tr><tr><td><span class="term"><tt class="literal">G_MARKUP_ERROR_PARSE</tt></span></td><td>document was ill-formed
</td></tr><tr><td><span class="term"><tt class="literal">G_MARKUP_ERROR_UNKNOWN_ELEMENT</tt></span></td><td>error should be set by <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> functions; element wasn't known
</td></tr><tr><td><span class="term"><tt class="literal">G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE</tt></span></td><td>error should be set by <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> functions; attribute wasn't known
</td></tr><tr><td><span class="term"><tt class="literal">G_MARKUP_ERROR_INVALID_CONTENT</tt></span></td><td>error should be set by <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> functions; something was wrong with contents of the document, e.g. invalid attribute value

</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3223405"></a><h3><a name="G-MARKUP-ERROR-CAPS"></a>G_MARKUP_ERROR</h3><a class="indexterm" name="id3223416"></a><pre class="programlisting">#define G_MARKUP_ERROR g_markup_error_quark ()
</pre><p>
Error domain for markup parsing. Errors in this domain will
be from the <a href="glib-Simple-XML-Subset-Parser.html#GMarkupError"><span class="type">GMarkupError</span></a> enumeration. See <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on 
error domains.
</p></div><hr><div class="refsect2" lang="en"><a name="id3223450"></a><h3><a name="GMarkupParseFlags"></a>enum GMarkupParseFlags</h3><a class="indexterm" name="id3223461"></a><pre class="programlisting">typedef enum
{
  /* Hmm, can't think of any at the moment */
  G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 &lt;&lt; 0
  
} GMarkupParseFlags;
</pre><p>
There are no flags right now. Pass "0" for the flags argument to all 
functions.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG</tt></span></td><td>flag you should not use.

</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3223501"></a><h3><a name="GMarkupParseContext"></a>struct GMarkupParseContext</h3><a class="indexterm" name="id3223512"></a><pre class="programlisting">struct GMarkupParseContext;</pre><p>
A parse context is used to parse a stream of bytes that you expect to
contain marked-up text. See <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-new"><tt class="function">g_markup_parse_context_new()</tt></a>,
<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a>, and so on for more details.
</p></div><hr><div class="refsect2" lang="en"><a name="id3223549"></a><h3><a name="GMarkupParser"></a>struct GMarkupParser</h3><a class="indexterm" name="id3223560"></a><pre class="programlisting">struct GMarkupParser {

  /* Called for open tags &lt;foo bar="baz"&gt; */
  void (*start_element)  (GMarkupParseContext *context,
                          const gchar         *element_name,
                          const gchar        **attribute_names,
                          const gchar        **attribute_values,
                          gpointer             user_data,
                          GError             **error);

  /* Called for close tags &lt;/foo&gt; */
  void (*end_element)    (GMarkupParseContext *context,
                          const gchar         *element_name,
                          gpointer             user_data,
                          GError             **error);

  /* Called for character data */
  /* text is not nul-terminated */
  void (*text)           (GMarkupParseContext *context,
                          const gchar         *text,
                          gsize                text_len,  
                          gpointer             user_data,
                          GError             **error);

  /* Called for strings that should be re-saved verbatim in this same
   * position, but are not otherwise interpretable.  At the moment
   * this includes comments and processing instructions.
   */
  /* text is not nul-terminated. */
  void (*passthrough)    (GMarkupParseContext *context,
                          const gchar         *passthrough_text,
                          gsize                text_len,  
                          gpointer             user_data,
                          GError             **error);

  /* Called on error, including one set by other
   * methods in the vtable. The GError should not be freed.
   */
  void (*error)          (GMarkupParseContext *context,
                          GError              *error,
                          gpointer             user_data);
};
</pre><p>
Any of the fields in <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> can be <tt class="literal">NULL</tt>, in which case they
will be ignored. Except for the <i class="parameter"><tt>error</tt></i> function, any of these
callbacks can set an error; in particular the
<tt class="literal">G_MARKUP_ERROR_UNKNOWN_ELEMENT</tt>, <tt class="literal">G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE</tt>,
and <tt class="literal">G_MARKUP_ERROR_INVALID_CONTENT</tt> errors are intended to be set 
from these callbacks. If you set an error from a callback,
<a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse"><tt class="function">g_markup_parse_context_parse()</tt></a> will report that error back to its caller.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term">void (*<i class="structfield"><tt>start_element</tt></i>) (GMarkupParseContext *context,
                          const gchar         *element_name,
                          const gchar        **attribute_names,
                          const gchar        **attribute_values,
                          gpointer             user_data,
                          GError             **error)</span></td><td>Callback to invoke when the opening tag of an element
is seen.
</td></tr><tr><td><span class="term">void (*<i class="structfield"><tt>end_element</tt></i>) (GMarkupParseContext *context,
                          const gchar         *element_name,
                          gpointer             user_data,
                          GError             **error)</span></td><td>Callback to invoke when the closing tag of an element is seen
</td></tr><tr><td><span class="term">void (*<i class="structfield"><tt>text</tt></i>) (GMarkupParseContext *context,
                          const gchar         *text,
                          gsize                text_len,  
                          gpointer             user_data,
                          GError             **error)</span></td><td>Callback to invoke when some text is seen (text is always
inside an element)
</td></tr><tr><td><span class="term">void (*<i class="structfield"><tt>passthrough</tt></i>) (GMarkupParseContext *context,
                          const gchar         *passthrough_text,
                          gsize                text_len,  
                          gpointer             user_data,
                          GError             **error)</span></td><td>Callback to invoke for comments, processing
instructions and doctype declarations; if you're re-writing the parsed document, write the
passthrough text back out in the same position
</td></tr><tr><td><span class="term">void (*<i class="structfield"><tt>error</tt></i>) (GMarkupParseContext *context,
                          GError              *error,
                          gpointer             user_data)</span></td><td>Callback to invoke when an error occurs

</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3223841"></a><h3><a name="g-markup-escape-text"></a>g_markup_escape_text ()</h3><a class="indexterm" name="id3223853"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_markup_escape_text            (const <a href="glib-Basic-Types.html#gchar">gchar</a> *text,
                                             <a href="glib-Basic-Types.html#gssize">gssize</a> length);</pre><p>
Escapes text so that the markup parser will parse it verbatim.
Less than, greater than, ampersand, etc. are replaced with the
corresponding entities. This function would typically be used
when writing out a file to be parsed with the markup parser.
</p><p>
Note that this function doesn't protect whitespace and line endings
from being processed according to the XML rules for normalization
of line endings and attribute values.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>text</tt></i> :</span></td><td> some valid UTF-8 text
</td></tr><tr><td><span class="term"><i class="parameter"><tt>length</tt></i> :</span></td><td> length of <i class="parameter"><tt>text</tt></i> in bytes
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> escaped text
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3223951"></a><h3><a name="g-markup-printf-escaped"></a>g_markup_printf_escaped ()</h3><a class="indexterm" name="id3223963"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_markup_printf_escaped         (const char *format,
                                             ...);</pre><p>
Formats arguments according to <i class="parameter"><tt>format</tt></i>, escaping
all string and character arguments in the fashion
of <a href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text"><tt class="function">g_markup_escape_text()</tt></a>. This is useful when you
want to insert literal strings into XML-style markup
output, without having to worry that the strings
might themselves contain markup.
</p><p>
</p><div class="informalexample"><pre class="programlisting">
const char *store = "Fortnum &amp; Mason";
const char *item = "Tea";
char *output;
 
output = g_markup_printf_escaped ("&lt;purchase&gt;"
                                  "&lt;store&gt;%s&lt;/store&gt;"
                                  "&lt;item&gt;%s&lt;/item&gt;"
                                  "&lt;/purchase&gt;",
                                  store, item);
</pre></div><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>format</tt></i> :</span></td><td> <tt class="function">printf()</tt> style format string
</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i> :</span></td><td> the arguments to insert in the format string
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> newly allocated result from formatting
 operation. Free with <a href="glib-Memory-Allocation.html#g-free"><tt class="function">g_free()</tt></a>.

</td></tr></tbody></table></div><p>Since  2.4
</p></div><hr><div class="refsect2" lang="en"><a name="id3224101"></a><h3><a name="g-markup-vprintf-escaped"></a>g_markup_vprintf_escaped ()</h3><a class="indexterm" name="id3224113"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gchar">gchar</a>*      g_markup_vprintf_escaped        (const char *format,
                                             va_list args);</pre><p>
Formats the data in <i class="parameter"><tt>args</tt></i> according to <i class="parameter"><tt>format</tt></i>, escaping
all string and character arguments in the fashion
of <a href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text"><tt class="function">g_markup_escape_text()</tt></a>. See <a href="glib-Simple-XML-Subset-Parser.html#g-markup-printf-escaped"><tt class="function">g_markup_printf_escaped()</tt></a>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>format</tt></i> :</span></td><td> <tt class="function">printf()</tt> style format string
</td></tr><tr><td><span class="term"><i class="parameter"><tt>args</tt></i> :</span></td><td> variable argument list, similar to <tt class="function">vprintf()</tt>
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> newly allocated result from formatting
 operation. Free with <a href="glib-Memory-Allocation.html#g-free"><tt class="function">g_free()</tt></a>.

</td></tr></tbody></table></div><p>Since  2.4
</p></div><hr><div class="refsect2" lang="en"><a name="id3224265"></a><h3><a name="g-markup-parse-context-end-parse"></a>g_markup_parse_context_end_parse ()</h3><a class="indexterm" name="id3224278"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_markup_parse_context_end_parse
                                            (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>
Signals to the <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a> that all data has been
fed into the parse context with <a href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse"><tt class="function">g_markup_parse_context_parse()</tt></a>.
This function reports an error if the document isn't complete,
for example if elements are still open.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>context</tt></i> :</span></td><td> a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>error</tt></i> :</span></td><td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> on success, <tt class="literal">FALSE</tt> if an error was set
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3224410"></a><h3><a name="g-markup-parse-context-free"></a>g_markup_parse_context_free ()</h3><a class="indexterm" name="id3224423"></a><pre class="programlisting">void        g_markup_parse_context_free     (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);</pre><p>
Frees a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. Can't be called from inside
one of the <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> functions.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>context</tt></i> :</span></td><td> a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3224498"></a><h3><a name="g-markup-parse-context-get-position"></a>g_markup_parse_context_get_position ()</h3><a class="indexterm" name="id3224510"></a><pre class="programlisting">void        g_markup_parse_context_get_position
                                            (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context,
                                             <a href="glib-Basic-Types.html#gint">gint</a> *line_number,
                                             <a href="glib-Basic-Types.html#gint">gint</a> *char_number);</pre><p>
Retrieves the current line number and the number of the character on
that line. Intended for use in error messages; there are no strict
semantics for what constitutes the "current" line number other than
"the best number we could come up with for error messages."</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>context</tt></i> :</span></td><td> a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>line_number</tt></i> :</span></td><td> return location for a line number, or <tt class="literal">NULL</tt>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>char_number</tt></i> :</span></td><td> return location for a char-on-line number, or <tt class="literal">NULL</tt>
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3224629"></a><h3><a name="g-markup-parse-context-get-element"></a>g_markup_parse_context_get_element ()</h3><a class="indexterm" name="id3224642"></a><pre class="programlisting">G_CONST_RETURN <a href="glib-Basic-Types.html#gchar">gchar</a>* g_markup_parse_context_get_element
                                            (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);</pre><p>
Retrieves the name of the currently open element.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>context</tt></i> :</span></td><td> a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the name of the currently open element, or <tt class="literal">NULL</tt>
</td></tr></tbody></table></div><p>Since  2.2
</p></div><hr><div class="refsect2" lang="en"><a name="id3224723"></a><h3><a name="g-markup-parse-context-new"></a>g_markup_parse_context_new ()</h3><a class="indexterm" name="id3224735"></a><pre class="programlisting"><a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a>* g_markup_parse_context_new
                                            (const <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser">GMarkupParser</a> *parser,
                                             <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags">GMarkupParseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data,
                                             <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> user_data_dnotify);</pre><p>
Creates a new parse context. A parse context is used to parse
marked-up documents. You can feed any number of documents into
a context, as long as no errors occur; once an error occurs,
the parse context can't continue to parse text (you have to free it
and create a new parse context).</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parser</tt></i> :</span></td><td> a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>flags</tt></i> :</span></td><td> one or more <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags"><span class="type">GMarkupParseFlags</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td> user data to pass to <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> functions
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data_dnotify</tt></i> :</span></td><td> user data destroy notifier called when the parse context is freed
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a new <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3224900"></a><h3><a name="g-markup-parse-context-parse"></a>g_markup_parse_context_parse ()</h3><a class="indexterm" name="id3224912"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_markup_parse_context_parse    (<a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *text,
                                             <a href="glib-Basic-Types.html#gssize">gssize</a> text_len,
                                             <a href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>
Feed some data to the <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. The data need not
be valid UTF-8; an error will be signaled if it's invalid.
The data need not be an entire document; you can feed a document
into the parser incrementally, via multiple calls to this function.
Typically, as you receive data from a network connection or file,
you feed each received chunk of data into this function, aborting
the process if an error occurs. Once an error is reported, no further
data may be fed to the <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>; all errors are fatal.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>context</tt></i> :</span></td><td> a <a href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>text</tt></i> :</span></td><td> chunk of text to parse
</td></tr><tr><td><span class="term"><i class="parameter"><tt>text_len</tt></i> :</span></td><td> length of <i class="parameter"><tt>text</tt></i> in bytes
</td></tr><tr><td><span class="term"><i class="parameter"><tt>error</tt></i> :</span></td><td> return location for a <a href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">FALSE</tt> if an error occurred, <tt class="literal">TRUE</tt> on success
</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Glob-style-pattern-matching.html"><b>&lt;&lt; Glob-style pattern matching</b></a></td><td align="right"><a accesskey="n" href="glib-Windows-Compatability-Functions.html"><b>Windows Compatibility Functions &gt;&gt;</b></a></td></tr></table></body></html>