0
我收到以下錯誤,當我分析我的XMLAndroid中的SAX解析器?
org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: no element found
04-01 22:23:13.661: WARN/System.err(628): at org.apache.harmony.xml.ExpatParser.finish(ExpatParser.java:553)
04-01 22:23:13.661: WARN/System.err(628): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:483)
04-01 22:23:13.672: WARN/System.err(628): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:320)
04-01 22:23:13.672: WARN/System.err(628): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:277)
這是我的代碼
url= new URL(queryString);
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
PersonHandler myExampleHandler = new PersonHandler();
xr.setContentHandler(myExampleHandler);
xr.parse(new InputSource(url.openStream()));
我struking兩天。 任何一個可以幫助我解決我的問題..
XML結構
<xml>
<item>
<queryType>compare-celebrity</queryType>
<memberID>43</memberID>
<memberName>Sachin</memberName>
<memberSurname>Ramesh</memberSurname>
<memberPersonalityType>[Red-Blue] Double</memberPersonalityType>
<celebrityID>118</celebrityID>
<celebrityName>Brad Pitt</celebrityName>
<thumbnail>brad-pitt-1299831254.jpeg</thumbnail>
</item>
</xml>
喜對不起,那朵是我的XML結構,TAT時間我被編輯的職位。 – David 2011-04-01 17:41:09
謝謝..更改根元素後。其工作正常 – David 2011-04-05 13:20:50
更改根元素後仍然收到解析器異常。並非所有的時間。 – David 2011-04-06 14:03:04