dom1.inc 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. function print_node($node)
  23. {
  24. print "Node Name: " . $node->nodeName;
  25. print "\nNode Type: " . $node->nodeType;
  26. $child_count = $node->childNodes->length;
  27. print "\nNum Children: " . $child_count;
  28. if($child_count <= 1){
  29. print "\nNode Content: " . $node->nodeValue;
  30. }
  31. print "\n\n";
  32. }
  33. function print_node_list($nodelist)
  34. {
  35. foreach($nodelist as $node)
  36. {
  37. print_node($node);
  38. }
  39. }
  40. ?>