Tuesday, May 14, 2024
69
rated 0 times [  76] [ 7]  / answers: 1 / hits: 15946  / 15 Years ago, sat, october 3, 2009, 12:00:00

Here's the snippet of code that won't validate:



if (user_age > 15 && user_age < 91)


It gets the following errors:




XML Parsing Error: StartTag: invalid element name




and




XML Parsing Error: xmlParseEntityRef: no name




The first error is thrown for the less than and the second one is thrown twice, once for each ampersand.



Replacing the above signs with & and < validates fine, but of course it completely ruins the function.


More From » xhtml-1.0-strict

 Answers
1

Or you can protect the script from the xml validation like this:



<script type=text/javascript> 
//<![CDATA[
if (user_age > 15 && user_age < 91) {
// do soemthing
}
//]]>
</script>

[#98576] Tuesday, September 29, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
amari

Total Points: 736
Total Questions: 111
Total Answers: 90

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;