This is caused by the different data encodings that are used. When you see the strange characters you are referring to this is almost always an encoding problem.
When you convert a string to a ByteArrayInputStream you should explicitly specify the encoding:
InputStream inputStream = new ByteArrayInputStream(stringXML.getBytes("UTF8"));
Your console test usually doesn't work with Java objects, when you print these objects as string (without some object specific functions) it will almost always print the memory location of the object such as your example.