DOMDocument_saveHTML_variant2.phpt 432 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. DOMDocument::saveHTML() vs DOMDocumet::saveXML()
  3. --SKIPIF--
  4. <?php
  5. require_once dirname(__FILE__) .'/skipif.inc';
  6. ?>
  7. --FILE--
  8. <?php
  9. $d = new DOMDocument();
  10. $str = <<<EOD
  11. <html>
  12. <head>
  13. </head>
  14. <body>
  15. <p>Hi.<br/>there</p>
  16. </body>
  17. </html>
  18. EOD;
  19. $d->loadHTML($str);
  20. $e = $d->getElementsByTagName("p");
  21. $e = $e->item(0);
  22. echo $d->saveXml($e),"\n";
  23. echo $d->saveHtml($e),"\n";
  24. --EXPECTF--
  25. <p>Hi.<br/>there</p>
  26. <p>Hi.<br>there</p>