[jdom-interest] How to get a org.jdom.Document from a org.w3 c.dom.Element ?

Keith Thomas K at XOL.com
Wed Aug 16 14:44:19 PDT 2000


That sounds like just what I need. I whole heatedly agree with your
suggestion that w3c element to jdom element conversion is really what we
need more than my suggested mixing of document & element types, i.e. I
really should have asked 'how to get a org.jdom.Element from a
org.w3c.dom.Element' and not 'how to get a org.jdom.Document from a

Keith Thomas

-----Original Message-----
From: Jason Hunter [mailto:jhunter at acm.org]
Sent: Wednesday, August 16, 2000 12:14 PM
To: Keith Thomas
Cc: 'jdom-interest at jdom.org'
Subject: Re: [jdom-interest] How to get a org.jdom.Document from a
org.w3c.dom.Element ?

Keith Thomas wrote:
> I assume by the (usual) deafening silence that I'll have to write 
> my own routine to chain through my org.w3c.dom.Element and build 
> my jdom document step by step. I think this kinda defeats the object 
> of the exercise and renders jdom ineffective for my requirements. 

The code you need exists in DOMBuilder; with 10 minutes of coding you
can modify it to do what you want in your own builder class.

Your question makes me think maybe DOMBuilder should have a public
method that builds a JDOM Element from a DOM Element.  

public Element build(org.w3c.dom.Element el)

We shouldn't build a doc from an element, but a user could add the new
element as the root of a new doc easily enough.  Any objections?


To control your jdom-interest membership:

More information about the jdom-interest mailing list