This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes Integrating JDOM with w3c DOM? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Integrating JDOM with w3c DOM?" Watch "Integrating JDOM with w3c DOM?" New topic
Author

Integrating JDOM with w3c DOM?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1063
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 12, 2002
Posts: 1063
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
Marshal

Joined: Mar 22, 2005
Posts: 41577
    
  54
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.


Ping & DNS - my free Android networking tools app
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1063
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
 
Consider Paul's rocket mass heater.
 
subject: Integrating JDOM with w3c DOM?