[jdom-interest] Getting String from a Document

Thomas M. Sasala tsasala at hifusion.com
Thu Jun 15 04:58:05 PDT 2000


	On the flip side, is there an easy way
to turn a string into a document?  We're using a 
ByteArrayInputStream now, but that seems a bit
klunky and kludgy to me.  Also, why assume that
all input sources of XML data are going to be
8-bit input streams?  What if the input source
is a serialized string?  That's 16-bit unicode.
The Stream verses Reader goes all the way
back to the Xerces and DOM tho....

	FWIW, I have some utils to help with the
whole process - Element2String, String2Element if
anyone is interested.

	-Tom

Wesley Biggs wrote:
> 
> ByteArrayOutputStream os = new ByteArrayOutputStream();
> xmlOutputter.output(document, os);
> String theOutput = os.toString();
>



More information about the jdom-interest mailing list