⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-simple-xml-subset-parser.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 4 页
字号:
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="G-MARKUP-DO-NOT-USE-THIS-UNSUPPORTED-FLAG:CAPS"></a><code class="literal">G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG</code></span></p></td><td>flag you should not use.</td></tr><tr><td><p><span class="term"><a name="G-MARKUP-TREAT-CDATA-AS-TEXT:CAPS"></a><code class="literal">G_MARKUP_TREAT_CDATA_AS_TEXT</code></span></p></td><td>When this flag is set, CDATA marked  sections are not passed literally to the <em class="parameter"><code>passthrough</code></em> function of  the parser. Instead, the content of the section (without the   <code class="literal">&lt;![CDATA[</code> and <code class="literal">]]&gt;</code>) is  passed to the <em class="parameter"><code>text</code></em> function. This flag was added in GLib 2.12.</td></tr><tr><td><p><span class="term"><a name="G-MARKUP-PREFIX-ERROR-POSITION:CAPS"></a><code class="literal">G_MARKUP_PREFIX_ERROR_POSITION</code></span></p></td><td>Normally errors caught by GMarkup  itself have line/column information prefixed to them to let the  caller know the location of the error.  When this flag is set the  location information is also prefixed to errors generated by the  <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> implementation functions.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3165166"></a><h3><a name="GMarkupParseContext"></a>GMarkupParseContext</h3><a class="indexterm" name="id3165179"></a><pre class="programlisting">typedef struct _GMarkupParseContext GMarkupParseContext;</pre><p>A parse context is used to parse a stream of bytes that you expect tocontain marked-up text. See <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-parse-context-new"><code class="function">g_markup_parse_context_new()</code></a>,<a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a>, and so on for more details.</p></div><hr><div class="refsect2" lang="en"><a name="id3165217"></a><h3><a name="GMarkupParser"></a>GMarkupParser</h3><a class="indexterm" name="id3165229"></a><pre class="programlisting">typedef struct {  /* Called for open tags &lt;foo bar="baz"&gt; */  void (*start_element)  (GMarkupParseContext *context,                          const gchar         *element_name,                          const gchar        **attribute_names,                          const gchar        **attribute_values,                          gpointer             user_data,                          GError             **error);  /* Called for close tags &lt;/foo&gt; */  void (*end_element)    (GMarkupParseContext *context,                          const gchar         *element_name,                          gpointer             user_data,                          GError             **error);  /* Called for character data */  /* text is not nul-terminated */  void (*text)           (GMarkupParseContext *context,                          const gchar         *text,                          gsize                text_len,                            gpointer             user_data,                          GError             **error);  /* Called for strings that should be re-saved verbatim in this same   * position, but are not otherwise interpretable.  At the moment   * this includes comments and processing instructions.   */  /* text is not nul-terminated. */  void (*passthrough)    (GMarkupParseContext *context,                          const gchar         *passthrough_text,                          gsize                text_len,                            gpointer             user_data,                          GError             **error);  /* Called on error, including one set by other   * methods in the vtable. The GError should not be freed.   */  void (*error)          (GMarkupParseContext *context,                          GError              *error,                          gpointer             user_data);} GMarkupParser;</pre><p>Any of the fields in <a class="link" href="glib-Simple-XML-Subset-Parser.html#GMarkupParser"><span class="type">GMarkupParser</span></a> can be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, in which case theywill be ignored. Except for the <em class="parameter"><code>error</code></em> function, any of thesecallbacks can set an error; in particular the<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>,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 from these callbacks. If you set an error from a callback,<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> will report that error back to its caller.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="structfield"><code>start_element</code></em>&#160;()</span></p></td><td>Callback to invoke when the opening tag of an element    is seen.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>end_element</code></em>&#160;()</span></p></td><td>Callback to invoke when the closing tag of an element is seen.    Note that this is also called for empty tags like     <code class="literal">&lt;empty/&gt;</code>.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>text</code></em>&#160;()</span></p></td><td>Callback to invoke when some text is seen (text is always    inside an element). Note that the text of an element may be spread    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>    flag is set, this function is also called for the content of CDATA marked     sections.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>passthrough</code></em>&#160;()</span></p></td><td>Callback to invoke for comments, processing instructions     and doctype declarations; if you're re-writing the parsed document,     write the passthrough text back out in the same position. 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> flag is not set, this function is also     called for CDATA marked sections.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>error</code></em>&#160;()</span></p></td><td>Callback to invoke when an error occurs.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3165515"></a><h3><a name="g-markup-escape-text"></a>g_markup_escape_text ()</h3><a class="indexterm" name="id3165528"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_markup_escape_text                (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *text,                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> length);</pre><p>Escapes text so that the markup parser will parse it verbatim.Less than, greater than, ampersand, etc. are replaced with thecorresponding entities. This function would typically be usedwhen writing out a file to be parsed with the markup parser.</p><p>Note that this function doesn't protect whitespace and line endingsfrom being processed according to the XML rules for normalizationof line endings and attribute values.</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>text</code></em>&#160;:</span></p></td><td> some valid UTF-8 text</td></tr><tr><td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td><td> length of <em class="parameter"><code>text</code></em> in bytes, or -1 if the text is nul-terminated</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> a newly allocated string with the escaped text</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3165628"></a><h3><a name="g-markup-printf-escaped"></a>g_markup_printf_escaped ()</h3><a class="indexterm" name="id3165643"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_markup_printf_escaped             (const char *format,                                                         ...);</pre><p>Formats arguments according to <em class="parameter"><code>format</code></em>, escapingall string and character arguments in the fashionof <a class="link" href="glib-Simple-XML-Subset-Parser.html#g-markup-escape-text"><code class="function">g_markup_escape_text()</code></a>. This is useful when youwant to insert literal strings into XML-style markupoutput, without having to worry that the stringsmight themselves contain markup.</p><p></p><div class="informalexample"><pre class="programlisting">const char *store = "Fortnum &amp; Mason";const char *item = "Tea";char *output;&#160;output = g_markup_printf_escaped ("&lt;purchase&gt;"                                  "&lt;store&gt;%s&lt;/store&gt;"                                  "&lt;item&gt;%s&lt;/item&gt;"                                  "&lt;/purchase&gt;",                                  store, item);</pre></div><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>format</code></em>&#160;:</span></p></td><td> <code class="function">printf()</code> style format string</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></p></td><td> the arguments to insert in the format string</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</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="id3165784"></a><h3><a name="g-markup-vprintf-escaped"></a>g_markup_vprintf_escaped ()</h3><a class="indexterm" name="id3165800"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*              g_markup_vprintf_escaped            (const char *format,                                                         va_list args);</pre><p>Formats the data in <em class="parameter"><code>args</code></em> according to <em class="parameter"><code>format</code></em>, escapingall string and character arguments in the fashionof <a class="link" href="glib-Simple-XML-Subset-Parser.html#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"><code class="function">g_markup_printf_escaped()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -