how to convert dom4j document object to string

Shamik picture Shamik · Apr 7, 2011 · Viewed 14.9k times · Source

Just trying to find a way to convert a Dom4J Document content to String. It has a asXML() API which converts the content to a XML. In my case,I'm editing a non-xml DOM structure using Dom4J and trying to convert the content to String. I know its possible in case of w3c document.

Any pointers will be appreciated.

Thanks

Answer

James picture James · Jul 22, 2016

asXml() return String from Document object

String text = document.asXML()