【发布时间】:2011-10-08 15:28:45
【问题描述】:
我有一个连接到 XMPP 服务器的客户端,服务器将答案发送给我
<?xml version="1.0"?><stream:stream id="119B61FB" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en">
我尝试使用Document 类创建XMLDocument:
try {
parser = factory.newDocumentBuilder();
d = parser.parse(new ByteArrayInputStream(cleanXMLString.getBytes("UTF-8")));
} catch (ParserConfigurationException ex) {
Logger.getLogger(XMPPManager.class.getName()).log(Level.SEVERE, null, ex);
} catch (SAXException ex) {
Logger.getLogger(XMPPManager.class.getName()).log(Level.SEVERE, null, ex);
}
但我得到了错误:
org.xml.sax.SAXParseException: XML document structures must start and end within the same entity of the SAXException.
有一种方法可以禁用这个限制,因为文档没有被</stream:stream>标签关闭是正常的?
【问题讨论】:
标签: java xml string xmpp document