tags:

views:

210

answers:

1

Team,

I am facing some issue at the time of parsing the XML, but the same works in Java program... When I run the same code through android prgming its failing to parse...

InputStream byteArrayInputStream = new ByteArrayInputStream( response.toString().getBytes());

SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(byteArrayInputStream, xmlHandler);

Facing the following error

DTD handlers aren't supported

Any help is greatly appreciated.

Thanks, Ramesh

A: 

There's a bug for that: http://code.google.com/p/android/issues/detail?id=4286
What works:

XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(//YourHandler extends DefaultHandler);
xmlReader.parse(new InputSource(//BufferedReader));
alex