dom_xinclude.phpt 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test: Xinclude and Streams
  3. --EXTENSIONS--
  4. dom
  5. --SKIPIF--
  6. <?php
  7. in_array('compress.zlib', stream_get_wrappers()) or die('skip compress.zlib wrapper is not available');
  8. ?>
  9. --FILE--
  10. <?php
  11. $dom = new domdocument;
  12. $data = file_get_contents(__DIR__."/xinclude.xml");
  13. $reldir = str_replace(getcwd(),".",__DIR__);
  14. if (DIRECTORY_SEPARATOR == '\\') {
  15. $reldir = str_replace('\\',"/", $reldir);
  16. }
  17. $data = str_replace('compress.zlib://ext/dom/tests/','compress.zlib://'.$reldir."/", $data);
  18. $dom->loadXML($data);
  19. $dom->xinclude();
  20. print $dom->saveXML()."\n";
  21. foreach ($dom->documentElement->childNodes as $node) {
  22. print $node->nodeName."\n";
  23. }
  24. ?>
  25. --EXPECTF--
  26. <?xml version="1.0"?>
  27. <foo xmlns:xi="http://www.w3.org/2001/XInclude">
  28. <book xml:base="compress.zlib://%sbook.xml">
  29. <title>The Grapes of Wrath</title>
  30. <author>John Steinbeck</author>
  31. </book><book xml:base="compress.zlib://%sbook.xml">
  32. <title>The Pearl</title>
  33. <author>John Steinbeck</author>
  34. </book>
  35. </foo>
  36. #text
  37. book
  38. book
  39. #text