If you have an InputStream and want to use it as an XML document, why don't you just parse it and go around the Document object? If you want to save this object, use serializers to write it as text.
As I noted in my commentary on Tom Hawtin, coding is very important when working with XML. Instead of writing a long entry here that might miss your specific situation, here is an article I wrote.
: , -, . , : XML Content-Type. XML - , , , . : -, , , /xml ( , , , ). - , application/xml utf-8. , , , - , .