-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathxml-parser-set-option.xml
More file actions
185 lines (179 loc) · 5.42 KB
/
xml-parser-set-option.xml
File metadata and controls
185 lines (179 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9acfa18973f304f8f2d531f28dd12b12c2b84f8b Maintainer: class007 Status: ready -->
<!-- CREDITS: mowangjuanzi, Luffy -->
<refentry xml:id="function.xml-parser-set-option" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>xml_parser_set_option</refname>
<refpurpose>在 XML 解析器中设置选项</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>xml_parser_set_option</methodname>
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
<methodparam><type class="union"><type>string</type><type>int</type><type>bool</type></type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
在 XML 解析器中设置选项。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>parser</parameter></term>
<listitem>
<para>
指向要设置选项的 XML 解析器。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
要设置的选项。见下文。
</para>
<para>
以下选项可用:
<table>
<title>XML 解析器选项</title>
<tgroup cols="3">
<thead>
<row>
<entry>选项常量</entry>
<entry>数据类型</entry>
<entry>说明</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>XML_OPTION_CASE_FOLDING</constant></entry>
<entry>bool</entry>
<entry>
控制是否为此 XML 解析器启用<link linkend="xml.case-folding">大写转换</link>。默认启用。
</entry>
</row>
<row>
<entry><constant>XML_OPTION_PARSE_HUGE</constant></entry>
<entry>bool</entry>
<entry>
允许解析大于 10 MB 的文档。
仅当文档大小有限时才应启用此选项,否则可能导致 DoS。
仅在使用 libxml2 时才可用。
</entry>
</row>
<row>
<entry><constant>XML_OPTION_SKIP_TAGSTART</constant></entry>
<entry>integer</entry>
<entry>
指定在标记名称的开头应略过多少个字符。
</entry>
</row>
<row>
<entry><constant>XML_OPTION_SKIP_WHITE</constant></entry>
<entry>bool</entry>
<entry>
是否略过由空白字符组成的值。
</entry>
</row>
<row>
<entry><constant>XML_OPTION_TARGET_ENCODING</constant></entry>
<entry>string</entry>
<entry>
设置要在此 XML 解析器中使用的<link linkend="xml.encoding">目标编码</link>。默认情况下,设置的编码与 <function>xml_parser_create</function>
使用的源编码相同。支持的目标编码有 <literal>ISO-8859-1</literal>、<literal>US-ASCII</literal> 和 <literal>UTF-8</literal>。
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
选项的新值。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功时返回 &true;,失败时返回 &false;。
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
当传递到 <parameter>option</parameter> 的值无效时抛出 <classname>ValueError</classname>。
</para>
<para>
在 PHP 8.0.0 之前,向 <parameter>option</parameter> 传递的值无效时会生成
<constant>E_WARNING</constant> 并使函数返回 &false;。
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
添加了选项 <constant>XML_OPTION_PARSE_HUGE</constant>。
</entry>
</row>
<row>
<entry>8.3.0</entry>
<entry>
<parameter>value</parameter> 参数现在也接受 bool。选项 <constant>XML_OPTION_CASE_FOLDING</constant> 和
<constant>XML_OPTION_SKIP_WHITE</constant> 现在是 bool 选项。
</entry>
</row>
&xml.changelog.parser-param;
<row>
<entry>8.0.0</entry>
<entry>
如果 <parameter>option</parameter> 无效,现在抛出 <classname>ValueError</classname>。
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->