i have this xml:
<user>
<name>H & M</name>
and i parse it using this code:
DocumentBuilder documentBuilder = null;
Document document = null;
try {
documentBuilder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
document = documentBuilder.parse(is);
} catch (Exception e) {
return result;
}
NodeList nl = document.getElementsByTagName(XML_RESPONSE_ROOT);
if (nl.getLength() > 0) {
resp_code = nl.item(0).getAttributes().getNamedItem(
XML_RESPONSE_STATUS).getNodeValue();
if (resp_code.equals(RESP_CODE_OK_SINGLE)) {
nl = document
.getElementsByTagName(XML_RESPONSE_TAG_CONTACT);
NodeList values = nl.item(i).getChildNodes();
etc..
when i get the node value by: node.getNodeValue();
i get only what's before the ampersand, even though the ampersand is escaped
i want to get the whole string: "H & M"
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…