I am using sax parser to parse XML as string in my application .When my code send HTML body as string then sax parser getting stuck for longer time (more than 5 hour).
Page source url : "http://www.cityam.com/taxonomy/term/1/all/feed" which i want to parse. This url giving HTML page instead of XML. How to handle this kind of problem or how to get out from my saxParser with appropriate exception. My code is here
public List<RssEntry> parseDocument(String body) {
// expected body is xml but getting stuck when get body of html page.
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();
parser.parse(new ByteArrayInputStream(body.getBytes("UTF-8")), this);
}
some catch block
Please help me.Thanks