I am trying to parse the input 'text' line, and for some reason it gets rid of ". It seems all & is being ignored. How do I get this part?
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);
when you print out
<text>"Resolutionary" ...</text>
will become "Resolutionary" ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.