How do I convert a org.w3c.dom.Document object to a String?

betahing

New Member
I want to convert a org.w3c.dom.Document object to a String. I'm using Java 6 and am open to using any (completely free) technology that is up to the task. I tried the solution from this thread -- Is there a more elegant way to convert an XML Document to a String in Java than this code?, where they have\[code\]DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();LSSerializer lsSerializer = domImplementation.createLSSerializer();String html = lsSerializer.writeToString(doc); \[/code\]but was greeted with the following horrendous exception
 
Back
Top