Reputation: 879
I'm using a WEB service which return XML format but with <
and >
instead of "<" and ">".
Now I dont know how to parse it?
I tried the standard SAX parser:
if (entity != null && responseCode==200) {
// A Simple JSON Response Read
InputStream instream = entity.getContent();
BufferedReader rd = null;
rd = new BufferedReader(new InputStreamReader(instream));
InputSource is=new InputSource(rd);
WebServiceRespondParser parser=new WebServiceRespondParser(category);
SAXParserFactory factory=SAXParserFactory.newInstance();
SAXParser sp=factory.newSAXParser();
XMLReader reader=sp.getXMLReader();
reader.setContentHandler(parser);
reader.parse(is);
markers=parser.getMarkers();
}
WEB service:
I read few similar question, but most are in different languages, or doesn't have answer.
Upvotes: 1
Views: 1160
Reputation: 30168
That XML is encoded because it's inside the tag. What you need to do is to first parse the original XML, then get the value from the tag. This will get you the proper XML that you can now parse as usual.
Upvotes: 2