📄 glib-simple-xml-subset-parser.html
字号:
<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 beenfed into the parse context with <a 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><span class="term"><em class="parameter"><code>context</code></em> :</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"><em class="parameter"><code>error</code></em> :</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> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if an error was set</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3076734"></a><h3><a name="g-markup-parse-context-free"></a>g_markup_parse_context_free ()</h3><a class="indexterm" name="id3076745"></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 insideone 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"><em class="parameter"><code>context</code></em> :</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="id3076820"></a><h3><a name="g-markup-parse-context-get-position"></a>g_markup_parse_context_get_position ()</h3><a class="indexterm" name="id3076832"></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 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><span class="term"><em class="parameter"><code>context</code></em> :</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"><em class="parameter"><code>line_number</code></em> :</span></td><td> return location for a line number, or <code class="literal">NULL</code></td></tr><tr><td><span class="term"><em class="parameter"><code>char_number</code></em> :</span></td><td> return location for a char-on-line number, or <code class="literal">NULL</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3076951"></a><h3><a name="g-markup-parse-context-get-element"></a>g_markup_parse_context_get_element ()</h3><a class="indexterm" name="id3076963"></a><pre class="programlisting">const <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"><em class="parameter"><code>context</code></em> :</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 <code class="literal">NULL</code></td></tr></tbody></table></div><p>Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id3077044"></a><h3><a name="g-markup-parse-context-new"></a>g_markup_parse_context_new ()</h3><a class="indexterm" name="id3077056"></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 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><span class="term"><em class="parameter"><code>parser</code></em> :</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"><em class="parameter"><code>flags</code></em> :</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"><em class="parameter"><code>user_data</code></em> :</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"><em class="parameter"><code>user_data_dnotify</code></em> :</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="id3077221"></a><h3><a name="g-markup-parse-context-parse"></a>g_markup_parse_context_parse ()</h3><a class="indexterm" name="id3077233"></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 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 furtherdata 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"><em class="parameter"><code>context</code></em> :</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"><em class="parameter"><code>text</code></em> :</span></td><td> chunk of text to parse</td></tr><tr><td><span class="term"><em class="parameter"><code>text_len</code></em> :</span></td><td> length of <em class="parameter"><code>text</code></em> in bytes</td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</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> <code class="literal">FALSE</code> if an error occurred, <code class="literal">TRUE</code> on success</td></tr></tbody></table></div></div></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><a href="http://www.w3.org/TR/REC-xml/" target="_top"><sup>[<a name="ftn.wellformed" href="#wellformed">2</a>] </sup>XML specification</a></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><< Glob-style pattern matching</b></a></td><td align="right"><a accesskey="n" href="glib-Key-value-file-parser.html"><b>Key-value file parser >></b></a></td></tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -