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

Jason Hunter jhunter at acm.org
Wed Aug 16 10:13:51 PDT 2000

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?


More information about the jdom-interest mailing list