我正在尝试解析输入'text'行,并且由于某种原因它摆脱了& quot。似乎所有&被忽略了。我该如何获得这部分内容?
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
String input = "<status> <id>000000014</id> <created_at>2012/03/07</created_at><text>"Resolutionary" ...</text> <retweet_count>2</retweet_count> <user> <name>Siggi Eggertsson</name> <location>Berlin, Germany</location> <description></description> <url>http://www.siggieggertsson.com</url> </user> </status> ";
Document document = builder.parse(new InputSource(new StringReader(
input)));
String value = document.getElementsByTagName("id").item(0)
.getTextContent();
System.out.println(value);
答案 0 :(得分:2)
<text>"Resolutionary" ...</text>
将成为 “决议”......