dom_xinclude.phpt 1.0 KB

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