1--TEST-- 2Test 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"); 9print "--- save as XML\n"; 10 11print adjustDoctype($dom->saveXML()); 12print "--- save as HTML\n"; 13 14print adjustDoctype($dom->saveHTML()); 15 16function adjustDoctype($xml) { 17 return str_replace(array("DOCTYPE HTML",'<p>','</p>'),array("DOCTYPE html",'',''),$xml); 18} 19 20--EXPECT-- 21--- save as XML 22<?xml version="1.0" standalone="yes"?> 23<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> 24<html><head><title>Hello world</title></head><body> 25This is a not well-formed<br/> 26html files with undeclared entities  27</body></html> 28--- save as HTML 29<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> 30<html><head><title>Hello world</title></head><body> 31This is a not well-formed<br> 32html files with undeclared entities 33</body></html> 34