我尝试解析以 ni utf 格式提供数据的网络资源,但是当我开始解析时,我得到:
12-08 11:30:44.097: E/Reader(670): org.xmlpull.v1.XmlPullParserException: Error parsing document. (position:line -1, column -1) caused by: org.apache.harmony.xml.ExpatParser$ParseException: At line 10, column 15: not well-formed (invalid token)
12-08 11:30:44.097: E/Reader(670): at org.apache.harmony.xml.ExpatPullParser$ByteDocument.flush(ExpatPullParser.java:958)
12-08 11:30:44.097: E/Reader(670): at org.apache.harmony.xml.ExpatPullParser$Document.pump(ExpatPullParser.java:769)
12-08 11:30:44.097: E/Reader(670): at org.apache.harmony.xml.ExpatPullParser$Document.dequeue(ExpatPullParser.java:813)
12-08 11:30:44.097: E/Reader(670): at org.apache.harmony.xml.ExpatPullParser.next(ExpatPullParser.java:302)
12-08 11:30:44.097: E/Reader(670): at org.apache.harmony.xml.ExpatPullParser.nextTag(ExpatPullParser.java:338)
12-08 11:30:44.097: E/Reader(670): at com.home.network.RssParser.parseSax(RssParser.java:78)
我在解析器中设置了 UTF-8 参数,但它没有帮助:
List<Feed> feeds = new ArrayList<Feed>();
try {
XmlPullParser parser = Xml.newPullParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
parser.setInput(is, "UTF-8");
// parser.setFeature(XmlPullParser., state)
parser.nextTag();
feeds = readFeed(parser);
} catch (XmlPullParserException e) {
Log.e("Reader", "Parse exception", e);
} catch (IOException e) {
Log.e("Reader", "Parse exception", e);
} finally {