Re: JSP XML with DOM
Are Nybakk wrote:
This seems so familiar. After several weeks of programming in JavaScript
I really got tired of the very clumsy DOM API. To make things simpler I
made my own abstraction. I defined an object type that had simple
methods that covered the uses I had, and it turned out there weren't
many. I defined methods that set the object's "root element" field; one
that took a XMLHttpRequest object and one that took any element. This
way I could create a new object for each step in an XML hierarchy and
use the very same methods instead of messing with childnode's
childnode's childnode and whatever.
I used this method to generate object-trees from xml-responses. (It was
inspired by JAX-B, however as far as I can see JavaScript can't offer
that kind of functionality what with annotations and all.) But anyway,
this method was so much cleaner than using the DOM API directly for
everything. Also, it's way more dynamical, resulting in looser dependency.
There are so many XML API's available in Java - many of them are
a lot simpler than W3C DOM.
XPath can often simplify things a lot.
JDOM is more Java and less W3C.
Some like DOM4J.
Arne