Annotation of embedaddon/php/ext/dom/tests/dom_comment_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: DOM Comment : Basic Functionality
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: ?>
7: --FILE--
8: <?php
9:
10: $xml = <<< EOXML
11: <?xml version="1.0" encoding="ISO-8859-1"?>
12: <courses>
13: <!-- Hello World! -->
14: </courses>
15: EOXML;
16:
17: $dom = new DOMDocument();
18: $dom->loadXML($xml);
19: $root = $dom->documentElement;
20: var_dump($root->hasChildNodes());
21: $children = $root->childNodes;
22:
23: for ($index = 0; $index < $children->length; $index++) {
24: echo "--- child $index ---\n";
25: $current = $children->item($index);
26: var_dump($current);
27: var_dump($current->textContent);
28: }
29:
30: --EXPECTF--
31: bool(true)
32: --- child 0 ---
33: object(DOMText)#%d (0) {
34: }
35: string(2) "
36: "
37: --- child 1 ---
38: object(DOMComment)#%d (0) {
39: }
40: string(14) " Hello World! "
41: --- child 2 ---
42: object(DOMText)#%d (0) {
43: }
44: string(1) "
45: "
46:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>