いくつかのUnicode文字を使用してXML出力を取得しようとしていました。タグ内の完全な文字列を読み取ることができませんでしたが、1つだけです。
これが私のXML出力です
<item>
<id>1</id>
<name>ලොල්</name>
<cost>155</cost>
<description>ලො</description>
</item>
これは、XML文字列を解析するために使用するJavaコードです。
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;
}
通常の英語の文字を使用すると、完全な文字列が得られます。