I have a client which connects to a XMPP Server, and the server send me the answer
<?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">
I try to create an XMLDocument with the Document class:
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);
}
but I get the error:
org.xml.sax.SAXParseException: XML document structures must start and end within the same entity of the SAXException.
There is a way to disable this restriction, because it is normal that the document is not closed by a </stream:stream> tag?
This is the first of many questions that you will have implementing XMPP.
You’ll need an incremental XML parser, like James Clark’s XP. Even better would be to use an existing XMPP library for Java from the list on xmpp.org.