Re: DOMDocument throws Unexpected end tag error when loading valid HTML
| From: | Nisse Engström | Date: | Mon, 07 Jun 2010 13:05:29 +0000 |
| Subject: | Re: DOMDocument throws Unexpected end tag error when loading valid HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-305878@lists.php.net to get a copy of this message | ||
On Sun, 6 Jun 2010 13:56:25 -0500, Raymond Irving wrote:
> Here's the script. Can anyone confirm this error or is there a known
> workaround?
>
> <?php
>
> $html = '
> <!DOCTYPE html>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8"/>
> <script type="text/javascript">
> var html = "<strong>Bold Text</strong>,Normal Text";
> document.write(html);
> alert(html);
> </script>
> </head>
> <body> </body>
> </html>
> ';
In HTML, the "</" sequence closes the <script> element.
You can escape the "/" character with a backslash:
<strong>Bold Text<\/strong>,Normal Text
/Nisse