DOMDocument_preserveWhiteSpace_variations.phpt 973 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. DOMDocument::$preserveWhiteSpace - test ability to read and write property
  3. --CREDITS--
  4. Lev Radin <prokurator@gmail.com>
  5. # TestFest 2009 NYPHP
  6. --EXTENSIONS--
  7. dom
  8. --FILE--
  9. <?php
  10. echo "Load document with preserveWhiteSpace on\n";
  11. $doc = new DOMDocument;
  12. $doc->load(__DIR__."/book.xml");
  13. echo $doc->saveXML();
  14. echo "\nLoad document with preserveWhiteSpace off\n";
  15. $doc = new DOMDocument;
  16. $doc->preserveWhiteSpace = false;
  17. $doc->load(__DIR__."/book.xml");
  18. echo $doc->saveXML();
  19. ?>
  20. --EXPECT--
  21. Load document with preserveWhiteSpace on
  22. <?xml version="1.0"?>
  23. <books>
  24. <book>
  25. <title>The Grapes of Wrath</title>
  26. <author>John Steinbeck</author>
  27. </book>
  28. <book>
  29. <title>The Pearl</title>
  30. <author>John Steinbeck</author>
  31. </book>
  32. </books>
  33. Load document with preserveWhiteSpace off
  34. <?xml version="1.0"?>
  35. <books><book><title>The Grapes of Wrath</title><author>John Steinbeck</author></book><book><title>The Pearl</title><author>John Steinbeck</author></book></books>