0
xml을 파싱하기위한 링크에서 코드를 사용했습니다. 안드로이드 2.3 이하 버전에서 작동했지만 4.0.3에서 모든 값을 반환하지 않습니다.이 문제점을 해결합니다. 알지 못합니다. output.Here가 link I used as codeAndroid 4.0에서 지원되는 XML을 구문 분석하는 방법은 무엇입니까?
@SuppressWarnings("unused")
public final static Document XMLfromString(String xml) {
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
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;
}
이 아니 그 같은, 그것은 캐치 부분에 아무것도 할 didnt한다. – Karthik
그럼 나도 몰라. ['DocumentBuilder.parse()'] (http://www.docjar.com/html/api/org/apache/xerces/jaxp/DocumentBuilderImpl.java.html)는 절대로'null '을 반환해서는 안됩니다. (Xerces가 사용 된 구현이라고 가정하면,'db.getClass(). getName()'에서 어떤 구현이 사용되는지 확인하십시오.) –