mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-19 06:16:58 +08:00
95 lines
3.8 KiB
HTML
95 lines
3.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>开始解析一个 XML 文档</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.xml-parse" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">xml_parse</h1>
|
||
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">xml_parse</span> — <span class="dc-title">开始解析一个 XML 文档</span></p>
|
||
|
||
</div>
|
||
<div class="refsect1 description" id="refsect1-function.xml-parse-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>xml_parse</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$parser</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
|
||
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$is_final</code><span class="initializer"> = false</span></span>
|
||
] ) : <span class="type">int</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>xml_parse()</strong></span> 解析 XML 文档。已配置事件的处理器根据需要被无限次调用。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.xml-parse-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">parser</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
一个指向将要使用的 XML 解析器的指针
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">data</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
需要解析的数据集。您可以多次对新的数据调用 <span class="function"><strong>xml_parse()</strong></span> 函数来分段解析一个文档;只要在解析最后一段数据时将 <code class="parameter">is_final</code> 参数设置为 <strong><code>TRUE</code></strong>。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">is_final</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
如果被设置为 <strong><code>TRUE</code></strong>,则 <code class="parameter">data</code> 为当前解析中最后一段数据。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.xml-parse-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回1,失败时返回0
|
||
</p>
|
||
<p class="para">
|
||
若解析失败,可以使用如下函数获取错误信息:
|
||
<span class="function"><a href="xml_get_error_code.html" class="function">xml_get_error_code()</a></span>,
|
||
<span class="function"><a href="xml_error_string.html" class="function">xml_error_string()</a></span>,
|
||
<span class="function"><a href="xml_get_current_line_number.html" class="function">xml_get_current_line_number()</a></span>,
|
||
<span class="function"><a href="xml_get_current_column_number.html" class="function">xml_get_current_column_number()</a></span> 和
|
||
<span class="function"><a href="xml_get_current_byte_index.html" class="function">xml_get_current_byte_index()</a></span>。
|
||
</p>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
将 <code class="parameter">is_final</code> 参数设置为 <strong><code>TRUE</code></strong>,项目的错误将会报告在数据的末尾。
|
||
</p>
|
||
</p></blockquote>
|
||
</div>
|
||
|
||
</div></div></div></body></html> |