xref: /PHP-7.0/ext/dom/tests/dom_test.inc (revision a016546e)
1<?PHP
2$xmlstr = "<?xml version='1.0' standalone='yes'?>
3<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
4[ <!ENTITY sp \"spanish\">
5]>
6<!-- lsfj  -->
7<chapter language='en'><title language='en'>Title</title>
8<para language='ge'>
9&sp;
10<!-- comment -->
11<informaltable language='&sp;kkk'>
12<tgroup cols='3'>
13<tbody>
14<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
15<row><entry>a2</entry><entry>c2</entry></row>
16<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
17</tbody>
18</tgroup>
19</informaltable>
20</para>
21</chapter> ";
22
23function print_node($node)
24{
25  print "Node Name: " . $node->nodeName;
26  print "\nNode Type: " . $node->nodeType;
27  if ($node->nodeType != 3) {
28      $child_count = $node->childNodes->length;
29  } else {
30      $child_count = 0;
31  }
32  print "\nNum Children: " . $child_count;
33  if($child_count <= 1){
34    print "\nNode Content: " . $node->nodeValue;
35  }
36  print "\n\n";
37}
38
39function print_node_list($nodelist)
40{
41  foreach($nodelist as $node)
42  {
43    print_node($node);
44  }
45}
46
47?>
48