📄 glib-simple-xml-subset-parser.html
字号:
<tbody><tr><td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td><td> <code class="function">printf()</code> style format string</td></tr><tr><td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td><td> variable argument list, similar to <code class="function">vprintf()</code></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> newly allocated result from formatting operation. Free with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3165955"></a><h3><a name="g-markup-parse-context-end-parse"></a>g_markup_parse_context_end_parse ()</h3><a class="indexterm" name="id3165968"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_markup_parse_context_end_parse (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Signals to the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a> that all data has beenfed into the parse context with <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-parse"><code class="function">g_markup_parse_context_parse()</code></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><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td><td> return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if an error was set</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3166110"></a><h3><a name="g-markup-parse-context-free"></a>g_markup_parse_context_free ()</h3><a class="indexterm" name="id3166124"></a><pre class="programlisting">void g_markup_parse_context_free (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);</pre><p>Frees a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. Can't be called from insideone of the <a class="link" 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><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" 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="id3166199"></a><h3><a name="g-markup-parse-context-get-position"></a>g_markup_parse_context_get_position ()</h3><a class="indexterm" name="id3166213"></a><pre class="programlisting">void g_markup_parse_context_get_position (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context, <a class="link" href="glib-Basic-Types.html#gint">gint</a> *line_number, <a class="link" href="glib-Basic-Types.html#gint">gint</a> *char_number);</pre><p>Retrieves the current line number and the number of the character onthat line. Intended for use in error messages; there are no strictsemantics 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><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>line_number</code></em> :</span></p></td><td> return location for a line number, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>char_number</code></em> :</span></p></td><td> return location for a char-on-line number, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3166340"></a><h3><a name="g-markup-parse-context-get-element"></a>g_markup_parse_context_get_element ()</h3><a class="indexterm" name="id3166357"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_markup_parse_context_get_element (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);</pre><p>Retrieves the name of the currently open element.</p><p>If called from the start_element or end_element handlers this willgive the element_name as passed to those functions. For the parentelements, see <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element-stack"><code class="function">g_markup_parse_context_get_element_stack()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the name of the currently open element, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id3166462"></a><h3><a name="g-markup-parse-context-get-element-stack"></a>g_markup_parse_context_get_element_stack ()</h3><a class="indexterm" name="id3166476"></a><pre class="programlisting">const <a class="link" href="glib-Singly-Linked-Lists.html#GSList">GSList</a>* g_markup_parse_context_get_element_stack (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context);</pre><p>Retrieves the element stack from the internal state of the parser.The returned <a class="link" href="glib-Singly-Linked-Lists.html#GSList"><span class="type">GSList</span></a> is a list of strings where the first item isthe currently open tag (as would be returned by<a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element"><code class="function">g_markup_parse_context_get_element()</code></a>) and the next item is itsimmediate parent.</p><p>This function is intended to be used in the start_element andend_element handlers where <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-get-element"><code class="function">g_markup_parse_context_get_element()</code></a>would merely return the name of the element that is beingprocessed.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td><td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the element stack, which must not be modifiedSince 2.16</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3166589"></a><h3><a name="g-markup-parse-context-new"></a>g_markup_parse_context_new ()</h3><a class="indexterm" name="id3166602"></a><pre class="programlisting"><a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a>* g_markup_parse_context_new (const <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser">GMarkupParser</a> *parser, <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags">GMarkupParseFlags</a> flags, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data, <a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> user_data_dnotify);</pre><p>Creates a new parse context. A parse context is used to parsemarked-up documents. You can feed any number of documents intoa context, as long as no errors occur; once an error occurs,the parse context can't continue to parse text (you have to free itand create a new parse context).</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>parser</code></em> :</span></p></td><td> a <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td><td> one or more <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseFlags"><span class="type">GMarkupParseFlags</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td><td> user data to pass to <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> functions</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data_dnotify</code></em> :</span></p></td><td> user data destroy notifier called when the parse context is freed</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a new <a class="link" 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="id3166767"></a><h3><a name="g-markup-parse-context-parse"></a>g_markup_parse_context_parse ()</h3><a class="indexterm" name="id3166781"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> g_markup_parse_context_parse (<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext">GMarkupParseContext</a> *context, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *text, <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> text_len, <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre><p>Feed some data to the <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParseContext"><span class="type">GMarkupParseContext</span></a>. The data need notbe valid UTF-8; an error will be signaled if it's invalid.The data need not be an entire document; you can feed a documentinto 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, abortingthe process if an error occurs. Once an error is reported, no further
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -