reference/dom/domdocument.xml
0217f85ed26dc9511fb6b44e87d82f4b77adafa1
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<phpdoc:classref xmlns:phpdoc="http://php.net/ns/phpdoc" xml:id="class.domdocument" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
3
+
<phpdoc:classref xml:id="class.domdocument" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
4
4
<title>The DOMDocument class</title>
5
5
<titleabbrev>DOMDocument</titleabbrev>
6
6
...
...
@@ -20,138 +20,159 @@
20
20
&reftitle.classsynopsis;
21
21
22
22
<!-- {{{ Synopsis -->
23
-
<classsynopsis>
24
-
<ooclass><classname>DOMDocument</classname></ooclass>
23
+
<classsynopsis class="class">
24
+
<ooclass>
25
+
<classname>DOMDocument</classname>
26
+
</ooclass>
25
27

26
-
<!-- {{{ Class synopsis -->
27
-
<classsynopsisinfo>
28
-
<ooclass>
29
-
<classname>DOMDocument</classname>
30
-
</ooclass>
28
+
<ooclass>
29
+
<modifier>extends</modifier>
30
+
<classname>DOMNode</classname>
31
+
</ooclass>
31
32

32
-
<!-- If the class extends another one, use this -->
33
-
<ooclass>
34
-
<modifier>extends</modifier>
35
-
<classname>DOMNode</classname>
36
-
</ooclass>
37
-
38
-
</classsynopsisinfo>
39
-
<!-- }}} -->
33
+
<oointerface>
34
+
<modifier>implements</modifier>
35
+
<interfacename>DOMParentNode</interfacename>
36
+
</oointerface>
40
37

41
38
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
42
-
<!-- If the property is documented below (xml:id=domdocument.props) use this -->
43
39
<fieldsynopsis>
44
-
<modifier>readonly</modifier>
45
40
<modifier>public</modifier>
46
-
<type>string</type>
47
-
<varname linkend="domdocument.props.actualencoding">actualEncoding</varname>
41
+
<modifier>readonly</modifier>
42
+
<type class="union"><type>DOMDocumentType</type><type>null</type></type>
43
+
<varname linkend="domdocument.props.doctype">doctype</varname>
48
44
</fieldsynopsis>
49
45
<fieldsynopsis>
50
-
<modifier>readonly</modifier>
51
46
<modifier>public</modifier>
52
-
<type>DOMConfiguration</type>
53
-
<varname linkend="domdocument.props.config">config</varname>
47
+
<modifier>readonly</modifier>
48
+
<type>DOMImplementation</type>
49
+
<varname linkend="domdocument.props.implementation">implementation</varname>
54
50
</fieldsynopsis>
55
51
<fieldsynopsis>
56
-
<modifier>readonly</modifier>
57
52
<modifier>public</modifier>
58
-
<type>DOMDocumentType</type>
59
-
<varname linkend="domdocument.props.doctype">doctype</varname>
53
+
<modifier>readonly</modifier>
54
+
<type class="union"><type>DOMElement</type><type>null</type></type>
55
+
<varname linkend="domdocument.props.documentelement">documentElement</varname>
60
56
</fieldsynopsis>
61
57
<fieldsynopsis>
58
+
<modifier>public</modifier>
62
59
<modifier>readonly</modifier>
60
+
<type class="union"><type>string</type><type>null</type></type>
61
+
<varname linkend="domdocument.props.actualencoding">actualEncoding</varname>
62
+
</fieldsynopsis>
63
+
<fieldsynopsis>
63
64
<modifier>public</modifier>
64
-
<type>DOMElement</type>
65
-
<varname linkend="domdocument.props.documentelement">documentElement</varname>
65
+
<type class="union"><type>string</type><type>null</type></type>
66
+
<varname linkend="domdocument.props.encoding">encoding</varname>
66
67
</fieldsynopsis>
67
68
<fieldsynopsis>
68
69
<modifier>public</modifier>
69
-
<type>string</type>
70
-
<varname linkend="domdocument.props.documenturi">documentURI</varname>
70
+
<modifier>readonly</modifier>
71
+
<type class="union"><type>string</type><type>null</type></type>
72
+
<varname linkend="domdocument.props.xmlencoding">xmlEncoding</varname>
71
73
</fieldsynopsis>
72
74
<fieldsynopsis>
73
75
<modifier>public</modifier>
74
-
<type>string</type>
75
-
<varname linkend="domdocument.props.encoding">encoding</varname>
76
+
<type>bool</type>
77
+
<varname linkend="domdocument.props.standalone">standalone</varname>
76
78
</fieldsynopsis>
77
79
<fieldsynopsis>
78
80
<modifier>public</modifier>
79
81
<type>bool</type>
80
-
<varname linkend="domdocument.props.formatoutput">formatOutput</varname>
82
+
<varname linkend="domdocument.props.xmlstandalone">xmlStandalone</varname>
81
83
</fieldsynopsis>
82
84
<fieldsynopsis>
83
-
<modifier>readonly</modifier>
84
85
<modifier>public</modifier>
85
-
<type>DOMImplementation</type>
86
-
<varname linkend="domdocument.props.implementation">implementation</varname>
86
+
<type class="union"><type>string</type><type>null</type></type>
87
+
<varname linkend="domdocument.props.version">version</varname>
87
88
</fieldsynopsis>
88
89
<fieldsynopsis>
89
90
<modifier>public</modifier>
90
-
<type>bool</type>
91
-
<varname linkend="domdocument.props.preservewhitespace">preserveWhiteSpace</varname>
92
-
<initializer>true</initializer>
91
+
<type class="union"><type>string</type><type>null</type></type>
92
+
<varname linkend="domdocument.props.xmlversion">xmlVersion</varname>
93
93
</fieldsynopsis>
94
94
<fieldsynopsis>
95
95
<modifier>public</modifier>
96
96
<type>bool</type>
97
-
<varname linkend="domdocument.props.recover">recover</varname>
97
+
<varname linkend="domdocument.props.stricterrorchecking">strictErrorChecking</varname>
98
+
</fieldsynopsis>
99
+
<fieldsynopsis>
100
+
<modifier>public</modifier>
101
+
<type class="union"><type>string</type><type>null</type></type>
102
+
<varname linkend="domdocument.props.documenturi">documentURI</varname>
103
+
</fieldsynopsis>
104
+
<fieldsynopsis>
105
+
<modifier>public</modifier>
106
+
<modifier>readonly</modifier>
107
+
<type>mixed</type>
108
+
<varname linkend="domdocument.props.config">config</varname>
98
109
</fieldsynopsis>
99
110
<fieldsynopsis>
100
111
<modifier>public</modifier>
101
112
<type>bool</type>
102
-
<varname linkend="domdocument.props.resolveexternals">resolveExternals</varname>
113
+
<varname linkend="domdocument.props.formatoutput">formatOutput</varname>
103
114
</fieldsynopsis>
104
115
<fieldsynopsis>
105
116
<modifier>public</modifier>
106
117
<type>bool</type>
107
-
<varname linkend="domdocument.props.standalone">standalone</varname>
118
+
<varname linkend="domdocument.props.validateonparse">validateOnParse</varname>
108
119
</fieldsynopsis>
109
120
<fieldsynopsis>
110
121
<modifier>public</modifier>
111
122
<type>bool</type>
112
-
<varname linkend="domdocument.props.stricterrorchecking">strictErrorChecking</varname>
113
-
<initializer>true</initializer>
123
+
<varname linkend="domdocument.props.resolveexternals">resolveExternals</varname>
114
124
</fieldsynopsis>
115
125
<fieldsynopsis>
116
126
<modifier>public</modifier>
117
127
<type>bool</type>
118
-
<varname linkend="domdocument.props.substituteentities">substituteEntities</varname>
128
+
<varname linkend="domdocument.props.preservewhitespace">preserveWhiteSpace</varname>
119
129
</fieldsynopsis>
120
130
<fieldsynopsis>
121
131
<modifier>public</modifier>
122
132
<type>bool</type>
123
-
<varname linkend="domdocument.props.validateonparse">validateOnParse</varname>
124
-
<initializer>false</initializer>
133
+
<varname linkend="domdocument.props.recover">recover</varname>
125
134
</fieldsynopsis>
126
135
<fieldsynopsis>
127
136
<modifier>public</modifier>
128
-
<type>string</type>
129
-
<varname linkend="domdocument.props.version">version</varname>
137
+
<type>bool</type>
138
+
<varname linkend="domdocument.props.substituteentities">substituteEntities</varname>
130
139
</fieldsynopsis>
131
140
<fieldsynopsis>
132
-
<modifier>readonly</modifier>
133
141
<modifier>public</modifier>
134
-
<type>string</type>
135
-
<varname linkend="domdocument.props.xmlencoding">xmlEncoding</varname>
142
+
<modifier>readonly</modifier>
143
+
<type class="union"><type>DOMElement</type><type>null</type></type>
144
+
<varname linkend="domdocument.props.firstelementchild">firstElementChild</varname>
136
145
</fieldsynopsis>
137
146
<fieldsynopsis>
138
147
<modifier>public</modifier>
139
-
<type>bool</type>
140
-
<varname linkend="domdocument.props.xmlstandalone">xmlStandalone</varname>
148
+
<modifier>readonly</modifier>
149
+
<type class="union"><type>DOMElement</type><type>null</type></type>
150
+
<varname linkend="domdocument.props.lastelementchild">lastElementChild</varname>
141
151
</fieldsynopsis>
142
152
<fieldsynopsis>
143
153
<modifier>public</modifier>
144
-
<type>string</type>
145
-
<varname linkend="domdocument.props.xmlversion">xmlVersion</varname>
154
+
<modifier>readonly</modifier>
155
+
<type>int</type>
156
+
<varname linkend="domdocument.props.childelementcount">childElementCount</varname>
146
157
</fieldsynopsis>
147
158

159
+
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
160
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.domnode')/db:partintro/db:section/db:classsynopsis/db:fieldsynopsis[preceding-sibling::db:classsynopsisinfo[1][@role='comment' and text()='&Properties;']]))">
161
+
<xi:fallback/>
162
+
</xi:include>
163
+

148
164
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
149
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.domdocument')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
165
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.domdocument')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='DOMDocument'])">
166
+
<xi:fallback/>
167
+
</xi:include>
168
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.domdocument')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DOMDocument'])">
169
+
<xi:fallback/>
170
+
</xi:include>
150
171

151
-
<!-- Again, if the class extends a class use this -->
152
172
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
153
-
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.domnode')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
154
-

173
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.domnode')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DOMNode'])">
174
+
<xi:fallback/>
175
+
</xi:include>
155
176
</classsynopsis>
156
177
<!-- }}} -->
157
178
...
...
@@ -171,6 +192,12 @@
171
192
</para>
172
193
</listitem>
173
194
</varlistentry>
195
+
<varlistentry xml:id="domdocument.props.childelementcount">
196
+
<term><varname>childElementCount</varname></term>
197
+
<listitem>
198
+
<para>The number of child elements.</para>
199
+
</listitem>
200
+
</varlistentry>
174
201
<varlistentry xml:id="domdocument.props.config">
175
202
<term><varname>config</varname></term>
176
203
<listitem>
...
...
@@ -191,8 +218,8 @@
191
218
<term><varname>documentElement</varname></term>
192
219
<listitem>
193
220
<para>
194
-
This is a convenience attribute that allows direct access to the
195
-
child node that is the document element of the document.
221
+
The <classname>DOMElement</classname> object that is the first
222
+
document element. If not found, this evaluates to &null;.
196
223
</para>
197
224
</listitem>
198
225
</varlistentry>
...
...
@@ -213,10 +240,20 @@
213
240
</para>
214
241
</listitem>
215
242
</varlistentry>
243
+
<varlistentry xml:id="domdocument.props.firstelementchild">
244
+
<term><varname>firstElementChild</varname></term>
245
+
<listitem>
246
+
<para>First child element or &null;.</para>
247
+
</listitem>
248
+
</varlistentry>
216
249
<varlistentry xml:id="domdocument.props.formatoutput">
217
250
<term><varname>formatOutput</varname></term>
218
251
<listitem>
219
-
<para>Nicely formats output with indentation and extra space.</para>
252
+
<para>
253
+
Nicely formats output with indentation and extra space.
254
+
This has no effect if the document was loaded with
255
+
<varname linkend="domdocument.props.preservewhitespace">preserveWhitespace</varname> enabled.
256
+
</para>
220
257
</listitem>
221
258
</varlistentry>
222
259
<varlistentry xml:id="domdocument.props.implementation">
...
...
@@ -228,10 +265,20 @@
228
265
</para>
229
266
</listitem>
230
267
</varlistentry>
268
+
<varlistentry xml:id="domdocument.props.lastelementchild">
269
+
<term><varname>lastElementChild</varname></term>
270
+
<listitem>
271
+
<para>Last child element or &null;.</para>
272
+
</listitem>
273
+
</varlistentry>
231
274
<varlistentry xml:id="domdocument.props.preservewhitespace">
232
275
<term><varname>preserveWhiteSpace</varname></term>
233
276
<listitem>
234
-
<para>Do not remove redundant white space. Default to &true;.</para>
277
+
<para>
278
+
Do not remove redundant white space. Default to &true;.
279
+
Setting this to &false; has the same effect as passing <constant>LIBXML_NOBLANKS</constant>
280
+
as <parameter>option</parameter> to <methodname>DOMDocument::load</methodname> etc.
281
+
</para>
235
282
</listitem>
236
283
</varlistentry>
237
284
<varlistentry xml:id="domdocument.props.recover">
...
...
@@ -276,14 +323,24 @@
276
323
<para>
277
324
<emphasis>Proprietary</emphasis>. Whether or not to substitute
278
325
entities. This attribute is not part of
279
-
the DOM specification and is specific to libxml.
326
+
the DOM specification and is specific to libxml. Default to &false;.
280
327
</para>
328
+
<caution>
329
+
<simpara>
330
+
Enabling entity substitution may facilitate XML External Entity (XXE) attacks.
331
+
</simpara>
332
+
</caution>
281
333
</listitem>
282
334
</varlistentry>
283
335
<varlistentry xml:id="domdocument.props.validateonparse">
284
336
<term><varname>validateOnParse</varname></term>
285
337
<listitem>
286
338
<para>Loads and validates against the DTD. Default to &false;.</para>
339
+
<caution>
340
+
<simpara>
341
+
Enabling validating the DTD may facilitate XML External Entity (XXE) attacks.
342
+
</simpara>
343
+
</caution>
287
344
</listitem>
288
345
</varlistentry>
289
346
<varlistentry xml:id="domdocument.props.version">
...
...
@@ -310,7 +367,10 @@
310
367
<listitem>
311
368
<para>
312
369
An attribute specifying, as part of the XML declaration, whether
313
-
this document is standalone. This is &false; when unspecified.
370
+
this document is standalone.
371
+
This is &false; when unspecified.
372
+
A standalone document is one where there are no external markup declarations.
373
+
An example of such a markup declaration is when the DTD declares an attribute with a default value.
314
374
</para>
315
375
</listitem>
316
376
</varlistentry>
...
...
@@ -328,16 +388,41 @@
328
388
</section>
329
389
<!-- }}} -->
330
390

391
+
<section role="changelog">
392
+
&reftitle.changelog;
393
+
<informaltable>
394
+
<tgroup cols="2">
395
+
<thead>
396
+
<row>
397
+
<entry>&Version;</entry>
398
+
<entry>&Description;</entry>
399
+
</row>
400
+
</thead>
401
+
<tbody>
402
+
<row>
403
+
<entry>8.0.0</entry>
404
+
<entry>
405
+
<classname>DOMDocument</classname> implements
406
+
<interfacename>DOMParentNode</interfacename> now.
407
+
</entry>
408
+
</row>
409
+
<row>
410
+
<entry>8.0.0</entry>
411
+
<entry>
412
+
The unimplemented method <methodname>DOMDocument::renameNode</methodname>
413
+
has been removed.
414
+
</entry>
415
+
</row>
416
+
</tbody>
417
+
</tgroup>
418
+
</informaltable>
419
+
</section>
420
+

331
421
<!-- {{{ Notes -->
332
422
<section role="notes">
333
423
&reftitle.notes;
334
-
<note>
335
-
<para>
336
-
The DOM extension uses UTF-8 encoding. Use <function>utf8_encode</function>
337
-
and <function>utf8_decode</function> to work with texts in ISO-8859-1
338
-
encoding or <link linkend="ref.iconv">Iconv</link> for other encodings.
339
-
</para>
340
-
</note>
424
+
&dom.note.utf8;
425
+
&dom.note.json;
341
426
</section>
342
427
<!-- }}} -->
343
428
...
...
@@ -357,7 +442,6 @@
357
442
&reference.dom.entities.domdocument;
358
443
359
444
</phpdoc:classref>
360
-
361
445
<!-- Keep this comment at the end of the file
362
446
Local variables:
363
447
mode: sgml
...
...
@@ -378,4 +462,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
378
462
vim: et tw=78 syn=sgml
379
463
vi: ts=1 sw=1
380
464
-->
381
-

382
465