Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


encoding of script tags in html

From: "Andy Fish" <ajfish@----------.--.-->
To: NULL
Date: 6/2/2008 12:35:00 PM

hi,

this is more an html parsing question than an XML question but I think it's 
the kind of thing that folks in an XML newsgroup would be more likely to 
help with, so please excuse me if it's a little off topic. please be aware 
that I am primarily talking about HTML rather than XHTML but I would also 
like to understand how XHTML works for when I prepare to convert the app to 
XHTML.

I have recently discovered that this:

<script>var x='</script>';</script>

is not valid HTML - the fact that there is an end script tag in quotes 
causes the parser to stop recognising the script. initially my reaction was 
that this is not a surprise because I had failed to HTML encode the script 
contents, so my second attempt was this:

<script>var x='&lt;/script&gt;';</script>

however this it DOES NOT WORK - the variable ends up containing the text 
"&lt;/script&gt;"

can someone point me at part of the w3c specification that states how script 
tags are parsed differently to other tags in HTML.

interestingly i have also discovered that this:

<script>if (3<5);</script>

IS valid html and seems even to be valid XHTML even though it is not valid 
XML

Andy 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent