convert dom4j docment to W3c document

Jorge picture Jorge · Nov 15, 2010 · Viewed 8.7k times · Source

i'm need to convert an xml build with dom4j to w3c document and don't have any idea about how do it...

Answer

Kirby picture Kirby · Apr 20, 2012

Check out DOMWriter. This works for me:

import org.dom4j.DocumentHelper;    
import org.dom4j.io.DOMWriter;

org.dom4j.Document dom4jDoc = DocumentHelper.createDocument();    
org.w3c.dom.Document w3cDoc = new DOMWriter().write(dom4jDoc)