wood burning stoves 2.0*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 1034
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: 18118
    
    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: 1034
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: 39547
    
  27
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 - updated with new look and Ping home screen widget
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integrating JDOM with w3c DOM?
 
Similar Threads
Document Object
Use Stream or String as input to SAXParser
Generate XML
DOM or SAX confusing
How to parse 100mb xml file