0
我搜索遠播這個問題,嘗試了許多修正,但我不能得到任何工作..蜂窩文檔解析錯誤
我試圖解析從我的服務器的XML文件,我可以檢索該文件沒關係,但當我去解析它,它錯誤。這裏是我的代碼:
public final static Document parse(String xml){
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
// ERRORS HERE
is.setCharacterStream(new StringReader(xml));
//
doc = db.parse(is);
} catch (ParserConfigurationException e) {
System.out.println("XML parse error: " + e.getMessage());
return null;
} catch (SAXException e) {
System.out.println("Wrong XML file structure: " + e.getMessage());
return null;
} catch (IOException e) {
System.out.println("I/O exeption: " + e.getMessage());
return null;
}
return doc;
}
,這裏是錯誤我得到:
12-02 20:26:22.340: E/AndroidRuntime(11600): java.lang.NullPointerException
12-02 20:26:22.340: E/AndroidRuntime(11600): at java.io.StringReader.<init>(StringReader.java:48)
12-02 20:26:22.340: E/AndroidRuntime(11600): at com.arayray.bootanimationutility.tablet.functions.DownloadFunctions.parse(DownloadFunctions.java:41)
我修好了...它似乎是嚴格模式阻止我的功能 – arayray