• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Integrating JDOM with w3c DOM?

 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our project uses DOM and I've had to use it, but I am really missing JDOM with its simplicity and logical programming methods/approach for Java devs.

I've read articles that "state" it's easy to integrate the two technologies (DOM/JDOM), but I've yet to see any code examples that shows how to integrate them.

In particular, I'd like to be able to use JDOM to create an XML structure then output it as a DOM stream, just as if I had created it with the DOM methods. Also, going the other way, I would like to be able to accept a DOM stream (object) and manipulate it using JDOM methods.

Can this integration be done?

Are there any examples, anywhere, to demonstrate?

Thanks vary much in advance.

- mike
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike, what's this "DOM stream" that you're asking about? Maybe I'm having a senior moment but that isn't a term I'm familiar with in the XML context. Could you maybe give us an example?
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Mike, what's this "DOM stream" that you're asking about? Maybe I'm having a senior moment but that isn't a term I'm familiar with in the XML context. Could you maybe give us an example?


Hi Paul,

Sorry, all I meant was I would like to be able to read in a DOM (as an object) -- say an XML Request, manipulate it with JDOM, and send it back as a DOM object. Things like that.

The "Stream" was only meant to imply it was an memory object, not a disk-based XML file.

Thanks,

-mike
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a lot of documentation is available for JDOM 2 except for the javadocs. Maybe start by checking out the org.jdom2.input.DOMBuilder and org.jdom2.output.DOMOutputter classes; those handle the conversion between org.w3c.dom.Document and org.jdom2.Document objects.
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Not a lot of documentation is available for JDOM 2 except for the javadocs. Maybe start by checking out the org.jdom2.input.DOMBuilder and org.jdom2.output.DOMOutputter classes; those handle the conversion between org.w3c.dom.Document and org.jdom2.Document objects.


Thanks Ulf.

Sounds like I didn't miss any tutorials or other helpful documentation then.

When I'm just left with mostly unhelpful JavaDocs (the documentation of last resort), it makes me wonder if anyone is using a particular feature.

JDOM is awesome and I was surprised that the architect for my project chose the now-ancient DOM.

Appreciate your reply.

Thanks very much.

-mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic