I was trying to get the XML output with some Unicode characters. I couldn't read the complete string inside the tag but just one.
here is my XML output
<item>
<id>1</id>
<name>ලොල්</name>
<cost>155</cost>
<description>ලො</description>
</item>
This is my java code which I use to parse XML string.
public Document getDomElement(String xml) {
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setEncoding("UTF-16");
is.setCharacterStream(new StringReader(xml));
doc = db.parse(is);
} catch (ParserConfigurationException e) {
Log.e("Error: ", e.getMessage());
return null;
} catch (SAXException e) {
Log.e("Error: ", e.getMessage());
return null;
} catch (IOException e) {
Log.e("Error: ", e.getMessage());
return null;
}
// return DOM
return doc;
}
When I use normal English characters it gives the complete string.