I am trying to read the contents of a String containing XML fields:-
String developer = "<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.priceover.com/pg_2.73.xsd">
<version>2.73</version>
<api_request_id>hashkeyint</api_request_id> <priceover_url>http://www.priceover.com/</priceover_url>
<priceover_url_text>Online Deals at Priceover.com</priceover_url_text><partner_url/><market>US</market></document>";
One way is to use Java's DOM library . Another is Java's SAX library .
Maybe I broke your question a little with the formation, however if your problems are only the qoutes you just need to mask them with a backslash that will look like that:
String example = "My string with \"quotes\"";
If your problem is primary about parsing the xml please read eebbesen's answer .
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.