0
海蘭, 我有又有些問題,我的XML解析器:dXML解析Document.parse以外的名稱錯誤
我解析字符串org.w3c.dom.Document中 他代碼:
String str = new String(IOUtilities.streamToBytes(is), "UTF-8");
InputSource source = new InputSource();
source.setCharacterStream(new StringReader(str));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setCoalescing(true);
dbf.setAllowUndefinedNamespaces(true);
DocumentBuilder db;
Document doc = null;
db = dbf.newDocumentBuilder();
doc = db.parse(source); // ERROR here
doc.getDocumentElement().normalize();
但我得到一個錯誤信息:期待一個名字
的字符串(重新格式化爲可讀):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. ---> Invalid Username or password</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>