我正在使用 sax 解析来检索数据,并且在以下位置出现这样的错误AsyncTask
:
org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 1615: not well-formed (invalid token)
org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:515)
org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:321)
org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
这里是我的代码:
protected Void doInBackground(Void... params) {
try {
URL rssUrl = new URL(
"http://www.google.co.in xxxxxxxx.in");
SAXParserFactory mySAXParserFactory = SAXParserFactory
.newInstance();
SAXParser mySAXParser = mySAXParserFactory.newSAXParser();
XMLReader myXMLReader = mySAXParser.getXMLReader();
HanldlerImple myRSSHandler = new HanldlerImple();
myXMLReader.setContentHandler(myRSSHandler);
InputSource myInputSource = new InputSource(rssUrl.openStream());
myXMLReader.parse(myInputSource);
data=myRSSHandler.getdetaillist();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
但是当我传递给 parse 方法时inputStream
,它不是inputSource
解析 XML 文件,但仍然存在telugu,tamil
字符之间的问题