Document to String?
<p>I've been fiddling with this for over twenty minutes and my Google-foo is failing me.</p>

<p>Let's say I have an XML Document created in Java (org.w3c.dom.Document):</p>

<pre><code>DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document document = docBuilder.newDocument();

Element rootElement = document.createElement("RootElement");
Element childElement = document.createElement("ChildElement");
childElement.appendChild(document.createTextNode("Child Text"));
rootElement.appendChild(childElement);

document.appendChild(rootElement);

String documentConvertedToString = "?" // &lt;---- How?
</code></pre>

<p>How do I convert the document object into a text string?</p>
