Re: [xml] DOM parser and HTML entities inside the <script> tag



Hi Michael,

Many thanks for the feedback.

The quotes are preserved in your example but when I run xmllint with the html content:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><script type="text/_javascript_">
   var d="&quot;Hello world;&quot; &lt;Test&gt; &amp; ";
   var h="<p>Some other text</p>";
</script></head></html>

I get the following result:

script.html:4: HTML parser error : Unexpected end tag : p
   var h="<p>Some other text</p>";
                                               ^
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><script type="text/_javascript_">
   var d="&quot;Hello world;&quot; &lt;Test&gt; &amp; ";
   var h="<p>Some other text";
</script></head></html>

The html parser removed the closing </p> tag from the script. 

IMO, I don't think the parser should be parsing content within the <script> tag


What do you think? 


Best regards,
__
Raymond 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]