In the following example, the closing </td> tag is missing.
Warning: DOMDocument::loadHTML(): Unexpected end tag : td in Entity, line: 4 in /home/adam/public_html/2010/10/23/dom.php on line 16 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body> <script type="text/x-jquery-tmpl" id="foo"> <td> </script></body></html>
<h1>Script tags and ETAGO (</)</h1>
<p>In the following example, the closing </td> tag is missing.</p>
<pre><?php
$s = <<<EOF
<html>
<body>
<script type="text/x-jquery-tmpl" id="foo">
<td></td>
</script>
</body>
</html>
EOF;
$d = new DOMDocument;
$d->loadHTML($s);
echo "\n" . htmlentities($d->saveHTML());
/*//
$d2 = new DOMDocument;
$d2->appendChild( $e );
//*/
?></pre>
<hr>
<h2>Contents</h2>
<?php highlight_file(__FILE__);