dom005.phpt 1007 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test 5: HTML Test
  3. --SKIPIF--
  4. <?php require_once('skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $dom = new domdocument;
  8. $dom->loadHTMLFile(dirname(__FILE__)."/test.html");
  9. print "--- save as XML\n";
  10. print adjustDoctype($dom->saveXML());
  11. print "--- save as HTML\n";
  12. print adjustDoctype($dom->saveHTML());
  13. function adjustDoctype($xml) {
  14. return str_replace(array("DOCTYPE HTML",'<p>','</p>'),array("DOCTYPE html",'',''),$xml);
  15. }
  16. --EXPECT--
  17. --- save as XML
  18. <?xml version="1.0" standalone="yes"?>
  19. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  20. <html><head><title>Hello world</title></head><body>
  21. This is a not well-formed<br/>
  22. html files with undeclared entities&#xA0;
  23. </body></html>
  24. --- save as HTML
  25. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  26. <html><head><title>Hello world</title></head><body>
  27. This is a not well-formed<br>
  28. html files with undeclared entities&nbsp;
  29. </body></html>