Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] javascript

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Luca Passani <passani AT eunet.no>
  • To: Michael Abato <maengden AT gmail.com>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] javascript
  • Date: Fri, 06 May 2005 15:40:07 +0200

Michael Abato wrote:

Depends on what you mean by "display". The stream produced by XOM will
alway encode the '<' as &lt; which is as it should be.

For human editing (vi and friends), people often like to use CDATA
blocks to get around this. But as CDATA has no impact on the infoset
(loosely speaking), there is no clean way to tell XOM to output it.

a dirty one will do too!

At the code level, re-reading the XML stream (string/file) will
produce a scriptElement whose getValue() method will return the '<' in
the string, which is exactly what you need to eval the script as
JavaScript proper, either client-side in the browser,

yeah, that's what I need. I am not sure how that turns into code from your description.
If you could be more specific, I would be grateful...


or server side
in rhino or equivelent. I've used code much like yours, sent it down
to a browser client via XMLHttpResponse, found the node using the
client DOM, and eval()'ed the value of the node.


got a code snippet?

If the goal is to display the javascript in html (e.g.: code sample),
it all depends on how you are producing the html.

I am just piping the modified DOM into a web browser with:

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(doc.toXML());


XSLT can produce the
desired result pretty naturally. JSP with XOM objects may or may not
require encoding/decoding in the code depending on whether you are
using the Element objects directly or the streamed XML

I am using a Java servlet...

Thank you

Luca





Archive powered by MHonArc 2.6.24.

Top of Page