我有这个代码:
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
StringBuilder text = new StringBuilder();
Utilities parser = new Utilities();
try {
BufferedReader br = new BufferedReader(new FileReader(xmlfile));
String line;
while ((line = br.readLine()) != null) {
text.append(line);
text.append('\n');
}
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(text.toString()));
doc = db.parse(is);
} catch (IOException e) {
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我收到了这个错误
org.xml.sax.SAXParseException: Unexpected token (position:TEXT 030812Z_1_CDEE94...@1:60 in java.io.StringReader@4278b0f0)
有没有人知道为什么我应该得到这个错误我在 ICS 和 4.1 上运行它并且它工作正常但是使用 4.2 我得到这个错误