I was hoping that it had something similar to
DocumentHelper.createDocument(Element) where it would create a dom4j tree
with the root at the w3c element.

Thanks - dave

-----Original Message-----
From: Maarten Coene [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 06, 2004 1:01 AM
To: David Thielen
Cc: [EMAIL PROTECTED]
Subject: Re: [dom4j-user] org.w3c.dom.Element -> dom4j.Element?

Hi David,

If you think about it, converting an org.w3c.dom.Element to a 
org.dom4j.Element is not that easy: what should you do with namespaces 
(declared elsewhere in an ancestor of the element), what should be the 
parent of the newly created dom4j.Element, ...  That's why you can't use 
the readElement(...) method in org.dom4j.io.DOMReader.

The safest way is to convert your org.w3c.dom.Document into an 
org.dom4j.Document using the org.dom4j.io.DOMReader like this:

org.w3c.dom.Document w3cDoc = ...;
DOMReader reader = new DOMReader();
org.dom4j.Document dom4jDoc = reader.read(w3cDoc);

and now walk through the dom4jDoc to the element you want ...

hope this helps
Maarten



David Thielen wrote:

>This looks like what I need. Is there any documentation for it? Or should I
>just experiment until I find a way that works? (readElement looks very
>interesting but doesn't return anything.)
>
>Thanks - dave
>
>
>-----Original Message-----
>From: Christian Niles [mailto:[EMAIL PROTECTED] 
>Sent: Wednesday, May 05, 2004 8:21 PM
>To: David Thielen
>Cc: [EMAIL PROTECTED]
>Subject: Re: [dom4j-user] org.w3c.dom.Element -> dom4j.Element?
>
>Have a look at org.dom4j.io.DOMReader:
>
>http://dom4j.org/apidocs/org/dom4j/io/DOMReader.html
>
>
>
>On May 5, 2004, at 10:03 PM, David Thielen wrote:
>
>  
>
>>Is there a way from an org.w3c.dom.Element to a dom4j.Element? It 
>>seems logical that you should be able to do it.
>>
>> 
>>
>>And if not, is there a way to get a dom4j Document from a w3c Document?
>>
>> 
>>
>>Thanks - dave
>>    
>>
>
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Sleepycat Software
>Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
>deliver higher performing products faster, at low TCO.
>http://www.sleepycat.com/telcomwpreg.php?From=dnemail3
>_______________________________________________
>dom4j-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/dom4j-user
>  
>




-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to