I try to parse xml from str
with this methods:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(str.toString()));
Document doc = db.parse(is);
and in str
i have :
<foo><bar>baz</bar></foo>
but always in db.parse(is);
the app is crash.
but if i put instead :
is.setCharacterStream(new StringReader(str.toString()));
this:
is.setCharacterStream(new StringReader("<foo><bar>baz</bar></foo>"));
it work perfect. any idea?