I believe that at the moment only the conversion from w3c document to
dom4j document is supported and there is also always the possibillity
to use DOMElement which can be used as both a w3c element and a dom4j
element.

The conversion code should look something like this:

<code>*

/**
 * Convert dom4j element to w3c element
 **/
public org.w3c.Element convert( org.dom4j.Element element) {
  org.dom4j.Document doc1 = DocumentHelper.createDocument();
  doc1.setRootElement( element);

  // Convert dom4j document to w3c document
  DOMWriter writer = new DOMWriter();
  org.w3c.Document doc2 = writer.write( doc1);

  return doc2.getDocumentElement() ;
}

/**
 * Convert w3c element to dom4j element
 **/
public org.dom4j.Element convert( org.w3c.Element element) {
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  DocumentBuilder builder = factory.newDocumentBuilder();

  org.w3c.Document doc1 = builder.newDocument();
  doc1.appendChild( element); 
  
  // Convert w3c document to dom4j document
  DOMReader reader = new DOMReader();
  org.dom4j.Document doc2 = reader.read( doc1);

  return doc2.getRootElement();
}

</code>

*Code not tested.

Regards,
Edwin


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to