Initial commit
[platform/upstream/glib2.0.git] / docs / reference / glib / html / glib-Simple-XML-Subset-Parser.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Simple XML Subset Parser</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-utilities.html" title="GLib Utilities">
9 <link rel="prev" href="glib-Perl-compatible-regular-expressions.html" title="Perl-compatible regular expressions">
10 <link rel="next" href="glib-Key-value-file-parser.html" title="Key-value file parser">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="chapter" href="glib.html" title="GLib Overview">
14 <link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
15 <link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
16 <link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
17 <link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
18 <link rel="chapter" href="tools.html" title="GLib Tools">
19 <link rel="index" href="api-index-full.html" title="Index">
20 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
21 <link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
22 <link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
23 <link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
24 <link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
25 <link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
26 <link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
27 <link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
28 <link rel="index" href="api-index-2-16.html" title="Index of new symbols in 2.16">
29 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
30 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
31 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
32 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
33 </head>
34 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
35 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
36 <tr valign="middle">
37 <td><a accesskey="p" href="glib-Perl-compatible-regular-expressions.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
38 <td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
39 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
40 <th width="100%" align="center">GLib Reference Manual</th>
41 <td><a accesskey="n" href="glib-Key-value-file-parser.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
42 </tr>
43 <tr><td colspan="5" class="shortcuts">
44 <a href="#glib-Simple-XML-Subset-Parser.synopsis" class="shortcut">Top</a>
45                    | 
46                   <a href="#glib-Simple-XML-Subset-Parser.description" class="shortcut">Description</a>
47 </td></tr>
48 </table>
49 <div class="refentry" title="Simple XML Subset Parser">
50 <a name="glib-Simple-XML-Subset-Parser"></a><div class="titlepage"></div>
51 <div class="refnamediv"><table width="100%"><tr>
52 <td valign="top">
53 <h2><span class="refentrytitle"><a name="glib-Simple-XML-Subset-Parser.top_of_page"></a>Simple XML Subset Parser</span></h2>
54 <p>Simple XML Subset Parser — parses a subset of XML</p>
55 </td>
56 <td valign="top" align="right"></td>
57 </tr></table></div>
58 <div class="refsynopsisdiv" title="Synopsis">
59 <a name="glib-Simple-XML-Subset-Parser.synopsis"></a><h2>Synopsis</h2>
60 <pre class="synopsis">
61 #include &lt;glib.h&gt;
62
63 enum                <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupError" title="enum GMarkupError">GMarkupError</a>;
64 #define             <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR:CAPS" title="G_MARKUP_ERROR">G_MARKUP_ERROR</a>
65 enum                <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags" title="enum GMarkupParseFlags">GMarkupParseFlags</a>;
66                     <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext">GMarkupParseContext</a>;
67                     <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser">GMarkupParser</a>;
68 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>*              <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text" title="g_markup_escape_text ()">g_markup_escape_text</a>                (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *text,
69                                                          <a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="returnvalue">gssize</span></a> length);
70 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-printf-escaped" title="g_markup_printf_escaped ()">g_markup_printf_escaped</a>             (const <span class="returnvalue">char</span> *format,
71                                                          ...);
72 <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-vprintf-escaped" title="g_markup_vprintf_escaped ()">g_markup_vprintf_escaped</a>            (const <span class="returnvalue">char</span> *format,
73                                                          <span class="returnvalue">va_list</span> args);
74 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-end-parse" title="g_markup_parse_context_end_parse ()">g_markup_parse_context_end_parse</a>    (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
75                                                          <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
76 <span class="returnvalue">void</span>                <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-free" title="g_markup_parse_context_free ()">g_markup_parse_context_free</a>         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);
77 <span class="returnvalue">void</span>                <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-position" title="g_markup_parse_context_get_position ()">g_markup_parse_context_get_position</a> (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
78                                                          <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> *line_number,
79                                                          <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> *char_number);
80 const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element" title="g_markup_parse_context_get_element ()">g_markup_parse_context_get_element</a>  (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);
81 const <a class="link" href="glib-Singly-Linked-Lists.html#GSList" title="GSList"><span class="returnvalue">GSList</span></a> *      <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element-stack" title="g_markup_parse_context_get_element_stack ()">g_markup_parse_context_get_element_stack</a>
82                                                         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);
83 <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-user-data" title="g_markup_parse_context_get_user_data ()">g_markup_parse_context_get_user_data</a>
84                                                         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);
85 <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> * <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-new" title="g_markup_parse_context_new ()">g_markup_parse_context_new</a>        (const <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="returnvalue">GMarkupParser</span></a> *parser,
86                                                          <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags" title="enum GMarkupParseFlags"><span class="returnvalue">GMarkupParseFlags</span></a> flags,
87                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data,
88                                                          <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="returnvalue">GDestroyNotify</span></a> user_data_dnotify);
89 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse" title="g_markup_parse_context_parse ()">g_markup_parse_context_parse</a>        (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
90                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *text,
91                                                          <a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="returnvalue">gssize</span></a> text_len,
92                                                          <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);
93 <span class="returnvalue">void</span>                <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-push" title="g_markup_parse_context_push ()">g_markup_parse_context_push</a>         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
94                                                          <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="returnvalue">GMarkupParser</span></a> *parser,
95                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);
96 <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-pop" title="g_markup_parse_context_pop ()">g_markup_parse_context_pop</a>          (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);
97
98 enum                <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupCollectType" title="enum GMarkupCollectType">GMarkupCollectType</a>;
99 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-collect-attributes" title="g_markup_collect_attributes ()">g_markup_collect_attributes</a>         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *element_name,
100                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **attribute_names,
101                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **attribute_values,
102                                                          <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error,
103                                                          <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupCollectType" title="enum GMarkupCollectType"><span class="returnvalue">GMarkupCollectType</span></a> first_type,
104                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *first_attr,
105                                                          ...);
106 </pre>
107 </div>
108 <div class="refsect1" title="Description">
109 <a name="glib-Simple-XML-Subset-Parser.description"></a><h2>Description</h2>
110 <p>
111 The "GMarkup" parser is intended to parse a simple markup format
112 that's a subset of XML. This is a small, efficient, easy-to-use
113 parser. It should not be used if you expect to interoperate with other
114 applications generating full-scale XML. However, it's very useful for
115 application data files, config files, etc. where you know your
116 application will be the only one writing the file. Full-scale XML
117 parsers should be able to parse the subset used by GMarkup, so you can
118 easily migrate to full-scale XML at a later time if the need arises.
119 </p>
120 <p>
121 GMarkup is not guaranteed to signal an error on all invalid XML; the
122 parser may accept documents that an XML parser would not. However, XML
123 documents which are not well-formed<sup>[<a name="wellformed" href="#ftn.wellformed" class="footnote">5</a>]</sup> are not considered valid GMarkup
124 documents.
125 </p>
126 <p>
127 Simplifications to XML include:
128 </p>
129 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
130 <li class="listitem"><p>
131 Only UTF-8 encoding is allowed.
132 </p></li>
133 <li class="listitem"><p>
134 No user-defined entities.
135 </p></li>
136 <li class="listitem"><p>
137 Processing instructions, comments and the doctype declaration are "passed
138 through" but are not interpreted in any way.
139 </p></li>
140 <li class="listitem"><p>
141 No DTD or validation.
142 </p></li>
143 </ul></div>
144 <p>
145 </p>
146 <p>
147 The markup format does support:
148 </p>
149 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
150 <li class="listitem"><p>
151 Elements
152 </p></li>
153 <li class="listitem"><p>
154 Attributes
155 </p></li>
156 <li class="listitem"><p>
157 5 standard entities: <code class="literal">&amp;amp; &amp;lt; &amp;gt; &amp;quot; &amp;apos;</code>
158 </p></li>
159 <li class="listitem"><p>
160 Character references
161 </p></li>
162 <li class="listitem"><p>
163 Sections marked as CDATA
164 </p></li>
165 </ul></div>
166 <p>
167 </p>
168 </div>
169 <div class="refsect1" title="Details">
170 <a name="glib-Simple-XML-Subset-Parser.details"></a><h2>Details</h2>
171 <div class="refsect2" title="enum GMarkupError">
172 <a name="GMarkupError"></a><h3>enum GMarkupError</h3>
173 <pre class="programlisting">typedef enum
174 {
175   G_MARKUP_ERROR_BAD_UTF8,
176   G_MARKUP_ERROR_EMPTY,
177   G_MARKUP_ERROR_PARSE,
178   /* The following are primarily intended for specific GMarkupParser
179    * implementations to set.
180    */
181   G_MARKUP_ERROR_UNKNOWN_ELEMENT,
182   G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
183   G_MARKUP_ERROR_INVALID_CONTENT,
184   G_MARKUP_ERROR_MISSING_ATTRIBUTE
185 } GMarkupError;
186 </pre>
187 <p>
188 Error codes returned by markup parsing.
189 </p>
190 <div class="variablelist"><table border="0">
191 <col align="left" valign="top">
192 <tbody>
193 <tr>
194 <td><p><a name="G-MARKUP-ERROR-BAD-UTF8:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_BAD_UTF8</code></span></p></td>
195 <td>text being parsed was not valid UTF-8
196 </td>
197 </tr>
198 <tr>
199 <td><p><a name="G-MARKUP-ERROR-EMPTY:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_EMPTY</code></span></p></td>
200 <td>document contained nothing, or only whitespace
201 </td>
202 </tr>
203 <tr>
204 <td><p><a name="G-MARKUP-ERROR-PARSE:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_PARSE</code></span></p></td>
205 <td>document was ill-formed
206 </td>
207 </tr>
208 <tr>
209 <td><p><a name="G-MARKUP-ERROR-UNKNOWN-ELEMENT:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_UNKNOWN_ELEMENT</code></span></p></td>
210 <td>error should be set by <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions; element wasn't known
211 </td>
212 </tr>
213 <tr>
214 <td><p><a name="G-MARKUP-ERROR-UNKNOWN-ATTRIBUTE:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE</code></span></p></td>
215 <td>error should be set by <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions; attribute wasn't known
216 </td>
217 </tr>
218 <tr>
219 <td><p><a name="G-MARKUP-ERROR-INVALID-CONTENT:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_INVALID_CONTENT</code></span></p></td>
220 <td>error should be set by <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions; content was invalid
221 </td>
222 </tr>
223 <tr>
224 <td><p><a name="G-MARKUP-ERROR-MISSING-ATTRIBUTE:CAPS"></a><span class="term"><code class="literal">G_MARKUP_ERROR_MISSING_ATTRIBUTE</code></span></p></td>
225 <td>error should be set by <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions; a required attribute was missing
226 </td>
227 </tr>
228 </tbody>
229 </table></div>
230 </div>
231 <hr>
232 <div class="refsect2" title="G_MARKUP_ERROR">
233 <a name="G-MARKUP-ERROR:CAPS"></a><h3>G_MARKUP_ERROR</h3>
234 <pre class="programlisting">#define G_MARKUP_ERROR g_markup_error_quark ()
235 </pre>
236 <p>
237 Error domain for markup parsing. Errors in this domain will
238 be from the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupError" title="enum GMarkupError"><span class="type">GMarkupError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> for information on
239 error domains.
240 </p>
241 </div>
242 <hr>
243 <div class="refsect2" title="enum GMarkupParseFlags">
244 <a name="GMarkupParseFlags"></a><h3>enum GMarkupParseFlags</h3>
245 <pre class="programlisting">typedef enum
246 {
247   G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 &lt;&lt; 0,
248   G_MARKUP_TREAT_CDATA_AS_TEXT              = 1 &lt;&lt; 1,
249   G_MARKUP_PREFIX_ERROR_POSITION            = 1 &lt;&lt; 2
250 } GMarkupParseFlags;
251 </pre>
252 <p>
253 Flags that affect the behaviour of the parser.
254 </p>
255 <div class="variablelist"><table border="0">
256 <col align="left" valign="top">
257 <tbody>
258 <tr>
259 <td><p><a name="G-MARKUP-DO-NOT-USE-THIS-UNSUPPORTED-FLAG:CAPS"></a><span class="term"><code class="literal">G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG</code></span></p></td>
260 <td>flag you should not use.
261 </td>
262 </tr>
263 <tr>
264 <td><p><a name="G-MARKUP-TREAT-CDATA-AS-TEXT:CAPS"></a><span class="term"><code class="literal">G_MARKUP_TREAT_CDATA_AS_TEXT</code></span></p></td>
265 <td>When this flag is set, CDATA marked
266   sections are not passed literally to the <em class="parameter"><code>passthrough</code></em> function of
267   the parser. Instead, the content of the section (without the
268   <code class="literal">&lt;![CDATA[</code> and <code class="literal">]]&gt;</code>) is
269   passed to the <em class="parameter"><code>text</code></em> function. This flag was added in GLib 2.12.
270 </td>
271 </tr>
272 <tr>
273 <td><p><a name="G-MARKUP-PREFIX-ERROR-POSITION:CAPS"></a><span class="term"><code class="literal">G_MARKUP_PREFIX_ERROR_POSITION</code></span></p></td>
274 <td>Normally errors caught by GMarkup
275   itself have line/column information prefixed to them to let the
276   caller know the location of the error.  When this flag is set the
277   location information is also prefixed to errors generated by the
278   <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> implementation functions.
279 </td>
280 </tr>
281 </tbody>
282 </table></div>
283 </div>
284 <hr>
285 <div class="refsect2" title="GMarkupParseContext">
286 <a name="GMarkupParseContext"></a><h3>GMarkupParseContext</h3>
287 <pre class="programlisting">typedef struct _GMarkupParseContext GMarkupParseContext;</pre>
288 <p>
289 A parse context is used to parse a stream of bytes that you expect to
290 contain marked-up text. See <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-new" title="g_markup_parse_context_new ()"><code class="function">g_markup_parse_context_new()</code></a>,
291 <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a>, and so on for more details.
292 </p>
293 </div>
294 <hr>
295 <div class="refsect2" title="GMarkupParser">
296 <a name="GMarkupParser"></a><h3>GMarkupParser</h3>
297 <pre class="programlisting">typedef struct {
298   /* Called for open tags &lt;foo bar="baz"&gt; */
299   void (*start_element)  (GMarkupParseContext *context,
300                           const gchar         *element_name,
301                           const gchar        **attribute_names,
302                           const gchar        **attribute_values,
303                           gpointer             user_data,
304                           GError             **error);
305
306   /* Called for close tags &lt;/foo&gt; */
307   void (*end_element)    (GMarkupParseContext *context,
308                           const gchar         *element_name,
309                           gpointer             user_data,
310                           GError             **error);
311
312   /* Called for character data */
313   /* text is not nul-terminated */
314   void (*text)           (GMarkupParseContext *context,
315                           const gchar         *text,
316                           gsize                text_len,  
317                           gpointer             user_data,
318                           GError             **error);
319
320   /* Called for strings that should be re-saved verbatim in this same
321    * position, but are not otherwise interpretable.  At the moment
322    * this includes comments and processing instructions.
323    */
324   /* text is not nul-terminated. */
325   void (*passthrough)    (GMarkupParseContext *context,
326                           const gchar         *passthrough_text,
327                           gsize                text_len,  
328                           gpointer             user_data,
329                           GError             **error);
330
331   /* Called on error, including one set by other
332    * methods in the vtable. The GError should not be freed.
333    */
334   void (*error)          (GMarkupParseContext *context,
335                           GError              *error,
336                           gpointer             user_data);
337 } GMarkupParser;
338 </pre>
339 <p>
340 Any of the fields in <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> can be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, in which case they
341 will be ignored. Except for the <em class="parameter"><code>error</code></em> function, any of these
342 callbacks can set an error; in particular the
343 <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-UNKNOWN-ELEMENT:CAPS"><code class="literal">G_MARKUP_ERROR_UNKNOWN_ELEMENT</code></a>, <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-UNKNOWN-ATTRIBUTE:CAPS"><code class="literal">G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE</code></a>,
344 and <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-INVALID-CONTENT:CAPS"><code class="literal">G_MARKUP_ERROR_INVALID_CONTENT</code></a> errors are intended to be set
345 from these callbacks. If you set an error from a callback,
346 <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse" title="g_markup_parse_context_parse ()"><code class="function">g_markup_parse_context_parse()</code></a> will report that error back to its caller.
347 </p>
348 <div class="variablelist"><table border="0">
349 <col align="left" valign="top">
350 <tbody>
351 <tr>
352 <td><p><span class="term"><em class="structfield"><code><a name="GMarkupParser.start-element"></a>start_element</code></em> ()</span></p></td>
353 <td>Callback to invoke when the opening tag of an element
354     is seen.
355 </td>
356 </tr>
357 <tr>
358 <td><p><span class="term"><em class="structfield"><code><a name="GMarkupParser.end-element"></a>end_element</code></em> ()</span></p></td>
359 <td>Callback to invoke when the closing tag of an element is seen.
360     Note that this is also called for empty tags like
361     <code class="literal">&lt;empty/&gt;</code>.
362 </td>
363 </tr>
364 <tr>
365 <td><p><span class="term"><em class="structfield"><code><a name="GMarkupParser.text"></a>text</code></em> ()</span></p></td>
366 <td>Callback to invoke when some text is seen (text is always
367     inside an element). Note that the text of an element may be spread
368     over multiple calls of this function. If the <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-TREAT-CDATA-AS-TEXT:CAPS"><code class="literal">G_MARKUP_TREAT_CDATA_AS_TEXT</code></a>
369     flag is set, this function is also called for the content of CDATA marked
370     sections.
371 </td>
372 </tr>
373 <tr>
374 <td><p><span class="term"><em class="structfield"><code><a name="GMarkupParser.passthrough"></a>passthrough</code></em> ()</span></p></td>
375 <td>Callback to invoke for comments, processing instructions 
376     and doctype declarations; if you're re-writing the parsed document,
377     write the passthrough text back out in the same position. If the
378     <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-TREAT-CDATA-AS-TEXT:CAPS"><code class="literal">G_MARKUP_TREAT_CDATA_AS_TEXT</code></a> flag is not set, this function is also
379     called for CDATA marked sections.
380 </td>
381 </tr>
382 <tr>
383 <td><p><span class="term"><em class="structfield"><code><a name="GMarkupParser.error"></a>error</code></em> ()</span></p></td>
384 <td>Callback to invoke when an error occurs.
385 </td>
386 </tr>
387 </tbody>
388 </table></div>
389 </div>
390 <hr>
391 <div class="refsect2" title="g_markup_escape_text ()">
392 <a name="g-markup-escape-text"></a><h3>g_markup_escape_text ()</h3>
393 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a>*              g_markup_escape_text                (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *text,
394                                                          <a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="returnvalue">gssize</span></a> length);</pre>
395 <p>
396 Escapes text so that the markup parser will parse it verbatim.
397 Less than, greater than, ampersand, etc. are replaced with the
398 corresponding entities. This function would typically be used
399 when writing out a file to be parsed with the markup parser.
400 </p>
401 <p>
402 Note that this function doesn't protect whitespace and line endings
403 from being processed according to the XML rules for normalization
404 of line endings and attribute values.
405 </p>
406 <p>
407 Note also that if given a string containing them, this function
408 will produce character references in the range of &amp;<span class="type">x1</span>; ..
409 &amp;<span class="type">x1f</span>; for all control sequences except for tabstop, newline
410 and carriage return.  The character references in this range are
411 not valid XML 1.0, but they are valid XML 1.1 and will be accepted
412 by the GMarkup parser.</p>
413 <div class="variablelist"><table border="0">
414 <col align="left" valign="top">
415 <tbody>
416 <tr>
417 <td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
418 <td> some valid UTF-8 text
419 </td>
420 </tr>
421 <tr>
422 <td><p><span class="term"><em class="parameter"><code>length</code></em> :</span></p></td>
423 <td> length of <em class="parameter"><code>text</code></em> in bytes, or -1 if the text is nul-terminated
424 </td>
425 </tr>
426 <tr>
427 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
428 <td> a newly allocated string with the escaped text
429 </td>
430 </tr>
431 </tbody>
432 </table></div>
433 </div>
434 <hr>
435 <div class="refsect2" title="g_markup_printf_escaped ()">
436 <a name="g-markup-printf-escaped"></a><h3>g_markup_printf_escaped ()</h3>
437 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             g_markup_printf_escaped             (const <span class="returnvalue">char</span> *format,
438                                                          ...);</pre>
439 <p>
440 Formats arguments according to <em class="parameter"><code>format</code></em>, escaping
441 all string and character arguments in the fashion
442 of <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text" title="g_markup_escape_text ()"><code class="function">g_markup_escape_text()</code></a>. This is useful when you
443 want to insert literal strings into XML-style markup
444 output, without having to worry that the strings
445 might themselves contain markup.
446 </p>
447 <p>
448 </p>
449 <div class="informalexample"><pre class="programlisting">
450 const char *store = "Fortnum &amp; Mason";
451 const char *item = "Tea";
452 char *output;
453  
454 output = g_markup_printf_escaped ("&lt;purchase&gt;"
455                                   "&lt;store&gt;%s&lt;/store&gt;"
456                                   "&lt;item&gt;%s&lt;/item&gt;"
457                                   "&lt;/purchase&gt;",
458                                   store, item);
459 </pre></div>
460 <div class="variablelist"><table border="0">
461 <col align="left" valign="top">
462 <tbody>
463 <tr>
464 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
465 <td> <code class="function">printf()</code> style format string
466 </td>
467 </tr>
468 <tr>
469 <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
470 <td> the arguments to insert in the format string
471 </td>
472 </tr>
473 <tr>
474 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
475 <td> newly allocated result from formatting
476  operation. Free with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.
477
478 </td>
479 </tr>
480 </tbody>
481 </table></div>
482 <p class="since">Since 2.4</p>
483 </div>
484 <hr>
485 <div class="refsect2" title="g_markup_vprintf_escaped ()">
486 <a name="g-markup-vprintf-escaped"></a><h3>g_markup_vprintf_escaped ()</h3>
487 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *             g_markup_vprintf_escaped            (const <span class="returnvalue">char</span> *format,
488                                                          <span class="returnvalue">va_list</span> args);</pre>
489 <p>
490 Formats the data in <em class="parameter"><code>args</code></em> according to <em class="parameter"><code>format</code></em>, escaping
491 all string and character arguments in the fashion
492 of <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text" title="g_markup_escape_text ()"><code class="function">g_markup_escape_text()</code></a>. See <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-printf-escaped" title="g_markup_printf_escaped ()"><code class="function">g_markup_printf_escaped()</code></a>.</p>
493 <div class="variablelist"><table border="0">
494 <col align="left" valign="top">
495 <tbody>
496 <tr>
497 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
498 <td> <code class="function">printf()</code> style format string
499 </td>
500 </tr>
501 <tr>
502 <td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td>
503 <td> variable argument list, similar to <code class="function">vprintf()</code>
504 </td>
505 </tr>
506 <tr>
507 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
508 <td> newly allocated result from formatting
509  operation. Free with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.
510
511 </td>
512 </tr>
513 </tbody>
514 </table></div>
515 <p class="since">Since 2.4</p>
516 </div>
517 <hr>
518 <div class="refsect2" title="g_markup_parse_context_end_parse ()">
519 <a name="g-markup-parse-context-end-parse"></a><h3>g_markup_parse_context_end_parse ()</h3>
520 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_markup_parse_context_end_parse    (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
521                                                          <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);</pre>
522 <p>
523 Signals to the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a> that all data has been
524 fed into the parse context with <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse" title="g_markup_parse_context_parse ()"><code class="function">g_markup_parse_context_parse()</code></a>.
525 This function reports an error if the document isn't complete,
526 for example if elements are still open.</p>
527 <div class="variablelist"><table border="0">
528 <col align="left" valign="top">
529 <tbody>
530 <tr>
531 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
532 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
533 </td>
534 </tr>
535 <tr>
536 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
537 <td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>
538 </td>
539 </tr>
540 <tr>
541 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
542 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error was set
543 </td>
544 </tr>
545 </tbody>
546 </table></div>
547 </div>
548 <hr>
549 <div class="refsect2" title="g_markup_parse_context_free ()">
550 <a name="g-markup-parse-context-free"></a><h3>g_markup_parse_context_free ()</h3>
551 <pre class="programlisting"><span class="returnvalue">void</span>                g_markup_parse_context_free         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);</pre>
552 <p>
553 Frees a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. Can't be called from inside
554 one of the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions. Can't be called while
555 a subparser is pushed.</p>
556 <div class="variablelist"><table border="0">
557 <col align="left" valign="top">
558 <tbody><tr>
559 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
560 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
561 </td>
562 </tr></tbody>
563 </table></div>
564 </div>
565 <hr>
566 <div class="refsect2" title="g_markup_parse_context_get_position ()">
567 <a name="g-markup-parse-context-get-position"></a><h3>g_markup_parse_context_get_position ()</h3>
568 <pre class="programlisting"><span class="returnvalue">void</span>                g_markup_parse_context_get_position (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
569                                                          <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> *line_number,
570                                                          <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> *char_number);</pre>
571 <p>
572 Retrieves the current line number and the number of the character on
573 that line. Intended for use in error messages; there are no strict
574 semantics for what constitutes the "current" line number other than
575 "the best number we could come up with for error messages."</p>
576 <div class="variablelist"><table border="0">
577 <col align="left" valign="top">
578 <tbody>
579 <tr>
580 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
581 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
582 </td>
583 </tr>
584 <tr>
585 <td><p><span class="term"><em class="parameter"><code>line_number</code></em> :</span></p></td>
586 <td> return location for a line number, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
587 </td>
588 </tr>
589 <tr>
590 <td><p><span class="term"><em class="parameter"><code>char_number</code></em> :</span></p></td>
591 <td> return location for a char-on-line number, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
592 </td>
593 </tr>
594 </tbody>
595 </table></div>
596 </div>
597 <hr>
598 <div class="refsect2" title="g_markup_parse_context_get_element ()">
599 <a name="g-markup-parse-context-get-element"></a><h3>g_markup_parse_context_get_element ()</h3>
600 <pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *       g_markup_parse_context_get_element  (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);</pre>
601 <p>
602 Retrieves the name of the currently open element.
603 </p>
604 <p>
605 If called from the start_element or end_element handlers this will
606 give the element_name as passed to those functions. For the parent
607 elements, see <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element-stack" title="g_markup_parse_context_get_element_stack ()"><code class="function">g_markup_parse_context_get_element_stack()</code></a>.</p>
608 <div class="variablelist"><table border="0">
609 <col align="left" valign="top">
610 <tbody>
611 <tr>
612 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
613 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
614 </td>
615 </tr>
616 <tr>
617 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
618 <td> the name of the currently open element, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
619 </td>
620 </tr>
621 </tbody>
622 </table></div>
623 <p class="since">Since 2.2</p>
624 </div>
625 <hr>
626 <div class="refsect2" title="g_markup_parse_context_get_element_stack ()">
627 <a name="g-markup-parse-context-get-element-stack"></a><h3>g_markup_parse_context_get_element_stack ()</h3>
628 <pre class="programlisting">const <a class="link" href="glib-Singly-Linked-Lists.html#GSList" title="GSList"><span class="returnvalue">GSList</span></a> *      g_markup_parse_context_get_element_stack
629                                                         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);</pre>
630 <p>
631 Retrieves the element stack from the internal state of the parser.
632 The returned <a class="link" href="glib-Singly-Linked-Lists.html#GSList" title="GSList"><span class="type">GSList</span></a> is a list of strings where the first item is
633 the currently open tag (as would be returned by
634 <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element" title="g_markup_parse_context_get_element ()"><code class="function">g_markup_parse_context_get_element()</code></a>) and the next item is its
635 immediate parent.
636 </p>
637 <p>
638 This function is intended to be used in the start_element and
639 end_element handlers where <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element" title="g_markup_parse_context_get_element ()"><code class="function">g_markup_parse_context_get_element()</code></a>
640 would merely return the name of the element that is being
641 processed.</p>
642 <div class="variablelist"><table border="0">
643 <col align="left" valign="top">
644 <tbody>
645 <tr>
646 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
647 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
648 </td>
649 </tr>
650 <tr>
651 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
652 <td> the element stack, which must not be modified
653
654 </td>
655 </tr>
656 </tbody>
657 </table></div>
658 <p class="since">Since 2.16</p>
659 </div>
660 <hr>
661 <div class="refsect2" title="g_markup_parse_context_get_user_data ()">
662 <a name="g-markup-parse-context-get-user-data"></a><h3>g_markup_parse_context_get_user_data ()</h3>
663 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            g_markup_parse_context_get_user_data
664                                                         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);</pre>
665 <p>
666 Returns the user_data associated with <em class="parameter"><code>context</code></em>.  This will either
667 be the user_data that was provided to <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-new" title="g_markup_parse_context_new ()"><code class="function">g_markup_parse_context_new()</code></a>
668 or to the most recent call of <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-push" title="g_markup_parse_context_push ()"><code class="function">g_markup_parse_context_push()</code></a>.</p>
669 <div class="variablelist"><table border="0">
670 <col align="left" valign="top">
671 <tbody>
672 <tr>
673 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
674 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
675 </td>
676 </tr>
677 <tr>
678 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
679 <td> the provided user_data. The returned data belongs to
680     the markup context and will be freed when <code class="function">g_markup_context_free()</code>
681     is called.
682
683 </td>
684 </tr>
685 </tbody>
686 </table></div>
687 <p class="since">Since 2.18</p>
688 </div>
689 <hr>
690 <div class="refsect2" title="g_markup_parse_context_new ()">
691 <a name="g-markup-parse-context-new"></a><h3>g_markup_parse_context_new ()</h3>
692 <pre class="programlisting"><a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> * g_markup_parse_context_new        (const <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="returnvalue">GMarkupParser</span></a> *parser,
693                                                          <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags" title="enum GMarkupParseFlags"><span class="returnvalue">GMarkupParseFlags</span></a> flags,
694                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data,
695                                                          <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="returnvalue">GDestroyNotify</span></a> user_data_dnotify);</pre>
696 <p>
697 Creates a new parse context. A parse context is used to parse
698 marked-up documents. You can feed any number of documents into
699 a context, as long as no errors occur; once an error occurs,
700 the parse context can't continue to parse text (you have to free it
701 and create a new parse context).</p>
702 <div class="variablelist"><table border="0">
703 <col align="left" valign="top">
704 <tbody>
705 <tr>
706 <td><p><span class="term"><em class="parameter"><code>parser</code></em> :</span></p></td>
707 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a>
708 </td>
709 </tr>
710 <tr>
711 <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
712 <td> one or more <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags" title="enum GMarkupParseFlags"><span class="type">GMarkupParseFlags</span></a>
713 </td>
714 </tr>
715 <tr>
716 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
717 <td> user data to pass to <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions
718 </td>
719 </tr>
720 <tr>
721 <td><p><span class="term"><em class="parameter"><code>user_data_dnotify</code></em> :</span></p></td>
722 <td> user data destroy notifier called when the parse context is freed
723 </td>
724 </tr>
725 <tr>
726 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
727 <td> a new <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
728 </td>
729 </tr>
730 </tbody>
731 </table></div>
732 </div>
733 <hr>
734 <div class="refsect2" title="g_markup_parse_context_parse ()">
735 <a name="g-markup-parse-context-parse"></a><h3>g_markup_parse_context_parse ()</h3>
736 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_markup_parse_context_parse        (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
737                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *text,
738                                                          <a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="returnvalue">gssize</span></a> text_len,
739                                                          <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error);</pre>
740 <p>
741 Feed some data to the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. The data need not
742 be valid UTF-8; an error will be signaled if it's invalid.
743 The data need not be an entire document; you can feed a document
744 into the parser incrementally, via multiple calls to this function.
745 Typically, as you receive data from a network connection or file,
746 you feed each received chunk of data into this function, aborting
747 the process if an error occurs. Once an error is reported, no further
748 data may be fed to the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>; all errors are fatal.</p>
749 <div class="variablelist"><table border="0">
750 <col align="left" valign="top">
751 <tbody>
752 <tr>
753 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
754 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
755 </td>
756 </tr>
757 <tr>
758 <td><p><span class="term"><em class="parameter"><code>text</code></em> :</span></p></td>
759 <td> chunk of text to parse
760 </td>
761 </tr>
762 <tr>
763 <td><p><span class="term"><em class="parameter"><code>text_len</code></em> :</span></p></td>
764 <td> length of <em class="parameter"><code>text</code></em> in bytes
765 </td>
766 </tr>
767 <tr>
768 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
769 <td> return location for a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a>
770 </td>
771 </tr>
772 <tr>
773 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
774 <td> <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if an error occurred, <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> on success
775 </td>
776 </tr>
777 </tbody>
778 </table></div>
779 </div>
780 <hr>
781 <div class="refsect2" title="g_markup_parse_context_push ()">
782 <a name="g-markup-parse-context-push"></a><h3>g_markup_parse_context_push ()</h3>
783 <pre class="programlisting"><span class="returnvalue">void</span>                g_markup_parse_context_push         (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context,
784                                                          <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="returnvalue">GMarkupParser</span></a> *parser,
785                                                          <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> user_data);</pre>
786 <p>
787 Temporarily redirects markup data to a sub-parser.
788 </p>
789 <p>
790 This function may only be called from the start_element handler of
791 a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a>.  It must be matched with a corresponding call to
792 <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-pop" title="g_markup_parse_context_pop ()"><code class="function">g_markup_parse_context_pop()</code></a> in the matching end_element handler
793 (except in the case that the parser aborts due to an error).
794 </p>
795 <p>
796 All tags, text and other data between the matching tags is
797 redirected to the subparser given by <em class="parameter"><code>parser</code></em>.  <em class="parameter"><code>user_data</code></em> is used
798 as the user_data for that parser.  <em class="parameter"><code>user_data</code></em> is also passed to the
799 error callback in the event that an error occurs.  This includes
800 errors that occur in subparsers of the subparser.
801 </p>
802 <p>
803 The end tag matching the start tag for which this call was made is
804 handled by the previous parser (which is given its own user_data)
805 which is why <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-pop" title="g_markup_parse_context_pop ()"><code class="function">g_markup_parse_context_pop()</code></a> is provided to allow "one
806 last access" to the <em class="parameter"><code>user_data</code></em> provided to this function.  In the
807 case of error, the <em class="parameter"><code>user_data</code></em> provided here is passed directly to
808 the error callback of the subparser and <code class="function">g_markup_parse_context()</code>
809 should not be called.  In either case, if <em class="parameter"><code>user_data</code></em> was allocated
810 then it ought to be freed from both of these locations.
811 </p>
812 <p>
813 This function is not intended to be directly called by users
814 interested in invoking subparsers.  Instead, it is intended to be
815 used by the subparsers themselves to implement a higher-level
816 interface.
817 </p>
818 <p>
819 As an example, see the following implementation of a simple
820 parser that counts the number of tags encountered.
821 </p>
822 <p>
823 </p>
824 <div class="informalexample"><pre class="programlisting">
825 typedef struct
826 {
827   gint tag_count;
828 } CounterData;
829
830 static void
831 counter_start_element (GMarkupParseContext  *context,
832                        const gchar          *element_name,
833                        const gchar         **attribute_names,
834                        const gchar         **attribute_values,
835                        gpointer              user_data,
836                        GError              **error)
837 {
838   CounterData *data = user_data;
839
840   data-&gt;tag_count++;
841 }
842
843 static void
844 counter_error (GMarkupParseContext *context,
845                GError              *error,
846                gpointer             user_data)
847 {
848   CounterData *data = user_data;
849
850   g_slice_free (CounterData, data);
851 }
852
853 static GMarkupParser counter_subparser =
854 {
855   counter_start_element,
856   NULL,
857   NULL,
858   NULL,
859   counter_error
860 };
861 </pre></div>
862 <p>
863 </p>
864 <p>
865 In order to allow this parser to be easily used as a subparser, the
866 following interface is provided:
867 </p>
868 <p>
869 </p>
870 <div class="informalexample"><pre class="programlisting">
871 void
872 start_counting (GMarkupParseContext *context)
873 {
874   CounterData *data = g_slice_new (CounterData);
875
876   data-&gt;tag_count = 0;
877   g_markup_parse_context_push (context, &amp;counter_subparser, data);
878 }
879
880 gint
881 end_counting (GMarkupParseContext *context)
882 {
883   CounterData *data = g_markup_parse_context_pop (context);
884   int result;
885
886   result = data-&gt;tag_count;
887   g_slice_free (CounterData, data);
888
889   return result;
890 }
891 </pre></div>
892 <p>
893 </p>
894 <p>
895 The subparser would then be used as follows:
896 </p>
897 <p>
898 </p>
899 <div class="informalexample"><pre class="programlisting">
900 static void start_element (context, element_name, ...)
901 {
902   if (strcmp (element_name, "count-these") == 0)
903     start_counting (context);
904
905   /* else, handle other tags... */
906 }
907
908 static void end_element (context, element_name, ...)
909 {
910   if (strcmp (element_name, "count-these") == 0)
911     g_print ("Counted %d tags\n", end_counting (context));
912
913   /* else, handle other tags... */
914 }
915 </pre></div>
916 <div class="variablelist"><table border="0">
917 <col align="left" valign="top">
918 <tbody>
919 <tr>
920 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
921 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
922 </td>
923 </tr>
924 <tr>
925 <td><p><span class="term"><em class="parameter"><code>parser</code></em> :</span></p></td>
926 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a>
927 </td>
928 </tr>
929 <tr>
930 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
931 <td> user data to pass to <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> functions
932 </td>
933 </tr>
934 </tbody>
935 </table></div>
936 <p class="since">Since 2.18</p>
937 </div>
938 <hr>
939 <div class="refsect2" title="g_markup_parse_context_pop ()">
940 <a name="g-markup-parse-context-pop"></a><h3>g_markup_parse_context_pop ()</h3>
941 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            g_markup_parse_context_pop          (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="returnvalue">GMarkupParseContext</span></a> *context);</pre>
942 <p>
943 Completes the process of a temporary sub-parser redirection.
944 </p>
945 <p>
946 This function exists to collect the user_data allocated by a
947 matching call to <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-push" title="g_markup_parse_context_push ()"><code class="function">g_markup_parse_context_push()</code></a>.  It must be called
948 in the end_element handler corresponding to the start_element
949 handler during which <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-push" title="g_markup_parse_context_push ()"><code class="function">g_markup_parse_context_push()</code></a> was called.  You
950 must not call this function from the error callback -- the
951 <em class="parameter"><code>user_data</code></em> is provided directly to the callback in that case.
952 </p>
953 <p>
954 This function is not intended to be directly called by users
955 interested in invoking subparsers.  Instead, it is intended to be
956 used by the subparsers themselves to implement a higher-level
957 interface.</p>
958 <div class="variablelist"><table border="0">
959 <col align="left" valign="top">
960 <tbody>
961 <tr>
962 <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
963 <td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext" title="GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>
964 </td>
965 </tr>
966 <tr>
967 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
968 <td> the user_data passed to <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-push" title="g_markup_parse_context_push ()"><code class="function">g_markup_parse_context_push()</code></a>.
969
970 </td>
971 </tr>
972 </tbody>
973 </table></div>
974 <p class="since">Since 2.18</p>
975 </div>
976 <hr>
977 <div class="refsect2" title="enum GMarkupCollectType">
978 <a name="GMarkupCollectType"></a><h3>enum GMarkupCollectType</h3>
979 <pre class="programlisting">typedef enum
980 {
981   G_MARKUP_COLLECT_INVALID,
982   G_MARKUP_COLLECT_STRING,
983   G_MARKUP_COLLECT_STRDUP,
984   G_MARKUP_COLLECT_BOOLEAN,
985   G_MARKUP_COLLECT_TRISTATE,
986
987   G_MARKUP_COLLECT_OPTIONAL = (1 &lt;&lt; 16)
988 } GMarkupCollectType;
989 </pre>
990 <p>
991 A mixed enumerated type and flags field.  You must specify one type
992 (string, strdup, boolean, tristate).  Additionally, you may
993 optionally bitwise OR the type with the flag
994 <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-COLLECT-OPTIONAL:CAPS"><code class="literal">G_MARKUP_COLLECT_OPTIONAL</code></a>.
995 </p>
996 <p>
997 It is likely that this enum will be extended in the future to
998 support other types.</p>
999 <div class="variablelist"><table border="0">
1000 <col align="left" valign="top">
1001 <tbody>
1002 <tr>
1003 <td><p><a name="G-MARKUP-COLLECT-INVALID:CAPS"></a><span class="term"><code class="literal">G_MARKUP_COLLECT_INVALID</code></span></p></td>
1004 <td> used to terminate the list of attributes
1005                            to collect.
1006 </td>
1007 </tr>
1008 <tr>
1009 <td><p><a name="G-MARKUP-COLLECT-STRING:CAPS"></a><span class="term"><code class="literal">G_MARKUP_COLLECT_STRING</code></span></p></td>
1010 <td> collect the string pointer directly from
1011                           the attribute_values[] array.  Expects a
1012                           parameter of type (const char **).  If
1013                           <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-COLLECT-OPTIONAL:CAPS"><code class="literal">G_MARKUP_COLLECT_OPTIONAL</code></a> is specified
1014                           and the attribute isn't present then the
1015                           pointer will be set to <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
1016 </td>
1017 </tr>
1018 <tr>
1019 <td><p><a name="G-MARKUP-COLLECT-STRDUP:CAPS"></a><span class="term"><code class="literal">G_MARKUP_COLLECT_STRDUP</code></span></p></td>
1020 <td> as with <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-COLLECT-STRING:CAPS"><code class="literal">G_MARKUP_COLLECT_STRING</code></a>, but
1021                           expects a parameter of type (char **) and
1022                           <a class="link" href="glib-String-Utility-Functions.html#g-strdup" title="g_strdup ()"><code class="function">g_strdup()</code></a>s the returned pointer.  The
1023                           pointer must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.
1024 </td>
1025 </tr>
1026 <tr>
1027 <td><p><a name="G-MARKUP-COLLECT-BOOLEAN:CAPS"></a><span class="term"><code class="literal">G_MARKUP_COLLECT_BOOLEAN</code></span></p></td>
1028 <td> expects a parameter of type (gboolean *)
1029                            and parses the attribute value as a
1030                            boolean.  Sets <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if the attribute
1031                            isn't present.  Valid boolean values
1032                            consist of (case insensitive) "false",
1033                            "f", "no", "n", "0" and "true", "t",
1034                            "yes", "y", "1".
1035 </td>
1036 </tr>
1037 <tr>
1038 <td><p><a name="G-MARKUP-COLLECT-TRISTATE:CAPS"></a><span class="term"><code class="literal">G_MARKUP_COLLECT_TRISTATE</code></span></p></td>
1039 <td> as with <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-COLLECT-BOOLEAN:CAPS"><code class="literal">G_MARKUP_COLLECT_BOOLEAN</code></a>, but
1040                             in the case of a missing attribute a
1041                             value is set that compares equal to
1042                             neither <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> nor <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.
1043                             G_MARKUP_COLLECT_OPTIONAL is implied.
1044 </td>
1045 </tr>
1046 <tr>
1047 <td><p><a name="G-MARKUP-COLLECT-OPTIONAL:CAPS"></a><span class="term"><code class="literal">G_MARKUP_COLLECT_OPTIONAL</code></span></p></td>
1048 <td> can be bitwise ORed with the other
1049                             fields.  If present, allows the
1050                             attribute not to appear.  A default
1051                             value is set depending on what value
1052                             type is used.
1053 </td>
1054 </tr>
1055 </tbody>
1056 </table></div>
1057 </div>
1058 <hr>
1059 <div class="refsect2" title="g_markup_collect_attributes ()">
1060 <a name="g-markup-collect-attributes"></a><h3>g_markup_collect_attributes ()</h3>
1061 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_markup_collect_attributes         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *element_name,
1062                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **attribute_names,
1063                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> **attribute_values,
1064                                                          <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="returnvalue">GError</span></a> **error,
1065                                                          <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupCollectType" title="enum GMarkupCollectType"><span class="returnvalue">GMarkupCollectType</span></a> first_type,
1066                                                          const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> *first_attr,
1067                                                          ...);</pre>
1068 <p>
1069 Collects the attributes of the element from the
1070 data passed to the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser" title="GMarkupParser"><span class="type">GMarkupParser</span></a> start_element
1071 function, dealing with common error conditions
1072 and supporting boolean values.
1073 </p>
1074 <p>
1075 This utility function is not required to write
1076 a parser but can save a lot of typing.
1077 </p>
1078 <p>
1079 The <em class="parameter"><code>element_name</code></em>, <em class="parameter"><code>attribute_names</code></em>,
1080 <em class="parameter"><code>attribute_values</code></em> and <em class="parameter"><code>error</code></em> parameters passed
1081 to the start_element callback should be passed
1082 unmodified to this function.
1083 </p>
1084 <p>
1085 Following these arguments is a list of
1086 "supported" attributes to collect.  It is an
1087 error to specify multiple attributes with the
1088 same name.  If any attribute not in the list
1089 appears in the <em class="parameter"><code>attribute_names</code></em> array then an
1090 unknown attribute error will result.
1091 </p>
1092 <p>
1093 The <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupCollectType" title="enum GMarkupCollectType"><span class="type">GMarkupCollectType</span></a> field allows specifying
1094 the type of collection to perform and if a
1095 given attribute must appear or is optional.
1096 </p>
1097 <p>
1098 The attribute name is simply the name of the
1099 attribute to collect.
1100 </p>
1101 <p>
1102 The pointer should be of the appropriate type
1103 (see the descriptions under
1104 <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupCollectType" title="enum GMarkupCollectType"><span class="type">GMarkupCollectType</span></a>) and may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> in case a
1105 particular attribute is to be allowed but
1106 ignored.
1107 </p>
1108 <p>
1109 This function deals with issuing errors for missing attributes 
1110 (of type <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-MISSING-ATTRIBUTE:CAPS"><code class="literal">G_MARKUP_ERROR_MISSING_ATTRIBUTE</code></a>), unknown attributes 
1111 (of type <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-UNKNOWN-ATTRIBUTE:CAPS"><code class="literal">G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE</code></a>) and duplicate 
1112 attributes (of type <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-INVALID-CONTENT:CAPS"><code class="literal">G_MARKUP_ERROR_INVALID_CONTENT</code></a>) as well 
1113 as parse errors for boolean-valued attributes (again of type
1114 <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-ERROR-INVALID-CONTENT:CAPS"><code class="literal">G_MARKUP_ERROR_INVALID_CONTENT</code></a>). In all of these cases <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> 
1115 will be returned and <em class="parameter"><code>error</code></em> will be set as appropriate.</p>
1116 <div class="variablelist"><table border="0">
1117 <col align="left" valign="top">
1118 <tbody>
1119 <tr>
1120 <td><p><span class="term"><em class="parameter"><code>element_name</code></em> :</span></p></td>
1121 <td> the current tag name
1122 </td>
1123 </tr>
1124 <tr>
1125 <td><p><span class="term"><em class="parameter"><code>attribute_names</code></em> :</span></p></td>
1126 <td> the attribute names
1127 </td>
1128 </tr>
1129 <tr>
1130 <td><p><span class="term"><em class="parameter"><code>attribute_values</code></em> :</span></p></td>
1131 <td> the attribute values
1132 </td>
1133 </tr>
1134 <tr>
1135 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
1136 <td> a pointer to a <a class="link" href="glib-Error-Reporting.html#GError" title="GError"><span class="type">GError</span></a> or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
1137 </td>
1138 </tr>
1139 <tr>
1140 <td><p><span class="term"><em class="parameter"><code>first_type</code></em> :</span></p></td>
1141 <td> the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupCollectType" title="enum GMarkupCollectType"><span class="type">GMarkupCollectType</span></a> of the
1142              first attribute
1143 </td>
1144 </tr>
1145 <tr>
1146 <td><p><span class="term"><em class="parameter"><code>first_attr</code></em> :</span></p></td>
1147 <td> the name of the first attribute
1148 </td>
1149 </tr>
1150 <tr>
1151 <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
1152 <td> a pointer to the storage location of the
1153       first attribute (or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>), followed by
1154       more types names and pointers, ending
1155       with <a class="link" href="glib-Simple-XML-Subset-Parser.html#G-MARKUP-COLLECT-INVALID:CAPS"><code class="literal">G_MARKUP_COLLECT_INVALID</code></a>.
1156 </td>
1157 </tr>
1158 <tr>
1159 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1160 <td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if successful
1161
1162 </td>
1163 </tr>
1164 </tbody>
1165 </table></div>
1166 <p class="since">Since 2.16</p>
1167 </div>
1168 </div>
1169 <div class="footnotes">
1170 <br><hr width="100" align="left">
1171 <div class="footnote"><a class="ulink" href="http://www.w3.org/TR/REC-xml/" target="_top"><sup>[<a name="ftn.wellformed" href="#wellformed" class="ulink">5</a>] </sup>XML specification</a></div>
1172 </div>
1173 </div>
1174 <div class="footer">
1175 <hr>
1176           Generated by GTK-Doc V1.13</div>
1177 </body>
1178 </html>