XML DOM to JavaScript

Bruce Dodson bruce_dodson.nospam at bigfoot.com
Wed Oct 25 20:00:20 EDT 2000


This should not be too difficult, especially if you can constrain yourself
to JavaScript versions that can understand [] and {} literals, or if you
don't mind if the client side executes a few extra lines to make it easier
for the server.  It would not be any harder, and might be less
memory-intensive, to stream from XML to JS using SAX-style events.

As an alternative to your alternative, if you find it too error-prone to
generate JavaScript code on the fly, and you want to keep your client side
lightweight, it might be worthwhile to send the tree in a line-oriented
format like Pyxie uses, rather than "free-form" XML.  A PYX data-island
could be parsed very easily by JavaScript.  (www.pyxie.org)

Bruce

<OlavB at yahoo.com> wrote in message news:39F70001.C4B173A9 at yahoo.com...
  Greetings!
My basic question is:
How can I convert XML DOM to JavaScript data-structures?
I have some XML-files that represents a data-structure, I would like to
generate HTML in the browser from the same structure with JavaScript, I am
already converting the DOM to CFML (ColdFusion) code.  In ColdFusion there
is this WDDX framework which converts the CFML DOM to Javacript statements
which generates a similar structure in JavaScript.
(WDDX seems to be intended as a standard for this kind of things, but I
haven't found any references to WDDX and Python)
Is there some way I can do this directly from Python.  Essentially I would
like to generate
a .js file from the corresponding .xml file
One alternative could be if I could somehow process the XML directly with
JavaScript)
Thanks!
Olav







More information about the Python-list mailing list