|
[xmlc] Javascript output into XHTML: msg#00041java.enhydra.xmlc
This is very frustrating. I want to output some javascript into my document via XMLC. The problem comes with < and > symbols. They get escaped into, for example: --- <script type="text/javascript"> for(var i=0;i < someArray.length; i++) { // do stuff } </script> --- This is invalid javascript, and generates an error in all the browsers I've tried. Personally, I find section 4.8 of the XHTML Specification (http://www.w3.org/TR/xhtml1/#h-4.8) to be rather ridiculous. Why would the contents of the <script> tag be PCDATA?!? Why would they force you to make your javascript into CDATA just to do some comparisons or loops? I'd love to hear any explanations other than "backwards compatibility" for this. Note that this is not a problem at all if I make my mime type "application/xhtml+xml", but then my page only works in Firefox, and I can't use any innerHTML javascript. The latter, I could eschew, but the former is a show stopper. I can't use the org.w3c.dom.Document.createCDATASection() method, because that results in something like: --- <script type="text/javascript"><![CDATA[ for(var i=0;i < someArray.length; i++) { // do stuff } ]]></script> --- And that's not valid javascript either! >From what I can tell from searching internet forums, you have to do something >like: --- <script> <!-- // <![CDATA[ --> for(var i=0;i < someArray.length; i++) { // do stuff } <!-- ]]> --> </script> --- Unfortunately, with the DOM methods available to me with XMLC, that's simply impossible to output. As far as I can see, the only solution to this is to put some lessThan(a, b) and greaterThan(a, b) methods into an included js file. Obviously, this solution is revolting, and I would love to hear any other suggestions you might have. Cheers, Erik -- You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx mailing list. To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [xmlc] Missing closing tags, Jacob Kjome |
|---|---|
| Next by Date: | Re: [xmlc] Javascript output into XHTML, Justin Akehurst |
| Previous by Thread: | [xmlc] Missing closing tags, tomc224 |
| Next by Thread: | Re: [xmlc] Javascript output into XHTML, Justin Akehurst |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |