reference/xml/functions/xml-parse.xml
3db49ee0a331a657dd97b539a749f53d3965b593
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.xml-parse">
3
+
<refentry xml:id="function.xml-parse" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>xml_parse</refname>
6
6
<refpurpose>Start parsing an XML document</refpurpose>
...
...
@@ -10,9 +10,9 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>int</type><methodname>xml_parse</methodname>
13
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
13
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
14
14
<methodparam><type>string</type><parameter>data</parameter></methodparam>
15
-
<methodparam choice="opt"><type>bool</type><parameter>is_final</parameter><initializer>false</initializer></methodparam>
15
+
<methodparam choice="opt"><type>bool</type><parameter>is_final</parameter><initializer>&false;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
<function>xml_parse</function> parses an XML document. The handlers for
...
...
@@ -71,14 +71,56 @@
71
71
</para>
72
72
<note>
73
73
<para>
74
-
Entity errors are reported at the end of the data thus only if
74
+
Some errors (such as entity errors) are reported at the end of the data, thus only if
75
75
<parameter>is_final</parameter> is set and &true;.
76
76
</para>
77
77
</note>
78
78
</refsect1>
79
79

80
-
</refentry>
80
+
<refsect1 role="changelog">
81
+
&reftitle.changelog;
82
+
<informaltable>
83
+
<tgroup cols="2">
84
+
<thead>
85
+
<row>
86
+
<entry>&Version;</entry>
87
+
<entry>&Description;</entry>
88
+
</row>
89
+
</thead>
90
+
<tbody>
91
+
&xml.changelog.parser-param;
92
+
</tbody>
93
+
</tgroup>
94
+
</informaltable>
95
+
</refsect1>
81
96

97
+
<refsect1 role="examples">
98
+
&reftitle.examples;
99
+
<example xml:id="xml_parse.example.chunked">
100
+
<title>Chunked parsing of large XML documents</title>
101
+
<para>
102
+
This example shows how large XML documents can be read and parsed in
103
+
chunks, so that it not necessary to keep the whole document in memory.
104
+
Error handling is omitted for brevity.
105
+
</para>
106
+
<programlisting role="php">
107
+
<![CDATA[
108
+
<?php
109
+
$stream = fopen('large.xml', 'r');
110
+
$parser = xml_parser_create();
111
+
// set up the handlers here
112
+
while (($data = fread($stream, 16384))) {
113
+
xml_parse($parser, $data); // parse the current chunk
114
+
}
115
+
xml_parse($parser, '', true); // finalize parsing
116
+
xml_parser_free($parser);
117
+
fclose($stream);
118
+
]]>
119
+
</programlisting>
120
+
</example>
121
+
</refsect1>
122
+

123
+
</refentry>
82
124
<!-- Keep this comment at the end of the file
83
125
Local variables:
84
126
mode: sgml
85
127