REXML bombs out in a javascript section of a well formed XHTML document

X

Xeno Campanoli

As far as I can see, this javascript should just be text for the XML parser,
n'est-ce pas? But I bomb out several lines into it with:

Illegal character '&' in raw string (referring to a javascript and (&&) operator
presumably. So, do we need to preparse the javascript out or something to be
able to do this stuff? What gives with that?

xc
 
J

James Britt

Xeno said:
As far as I can see, this javascript should just be text for the XML parser,
n'est-ce pas? But I bomb out several lines into it with:

"this javascript" did not make it to my mail reader; did you include it?
Illegal character '&' in raw string (referring to a javascript and (&&) operator
presumably. So, do we need to preparse the javascript out or something to be
able to do this stuff? What gives with that?

Unless you are hiding the script element content with XML comment markup
or wrapping it in CDATA markup, then it is interpreted as normal XML
fodder, and the ampersand has a special meaning.

James
--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys
 
P

Phrogz

James said:
Unless you are hiding the script element content with XML comment markup
or wrapping it in CDATA markup, then it is interpreted as normal XML
fodder, and the ampersand has a special meaning.

To elaborate by example:

<?xml version="1.0"?>
<foo><script>if (a && b || 5 < 6) alert("Hi!")</script></foo>
^---------^-------- ILLEGAL CHARACTERS

<?xml version="1.0"?>
<foo><script><![CDATA[if (a && b || 5 < 6)
alert("Hi!")]]></script></foo>
LEGAL!


<?xml version="1.0"?>
<foo><script>if (a &amp;&amp; b || 5 &lt; 6)
alert("Hi!")</script></foo>
LEGAL!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top