wood burning stoves
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 Head First Android this week in the Android 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: 1101
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

Joined: Oct 14, 2005
Posts: 19693
    
  10

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: 1101
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

Joined: Mar 22, 2005
Posts: 42956
    
  73
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

Joined: Jul 12, 2002
Posts: 1101
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
 
Don't get me started about those stupid light bulbs.
 
subject: Integrating JDOM with w3c DOM?
 
It's not a secret anymore!