开发者

android : sax Xml parsing

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(byteArrayInputStr开发者_运维百科eam, xmlHandler);

Facing the following error

DTD handlers aren't supported

Any help is greatly appreciated.

Thanks, Ramesh


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));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜