[jdev] Re: Re: Re: Parsing XMPP/Jabber protocol
Maxym Gorodetskyy
maxgor at topletter.com
Sun Jan 2 14:39:31 CST 2005
Cathayan wrote:
> if i don't misunderstand it, java xerces2's SAX parser can deal with
> delayed inputstream very well, i just tried it and get the jabber
> server's returned id correctly, no tricks needed again.
>
> see it:
>
> http://xml.apache.org/xerces2-j/samples-socket.html#DelayedInput
>
>
Yes, yes, yes, you did not!
Socket clientConnection = new Socket();
clientConnection.connect(new InetSocketAddress("127.0.0.1", 2000));
OutputStream stream = clientConnection.getOutputStream();
String s1 = "<?xml version=\"1.0\"?><str";
String s2 = "eam><element>qwe</element></stream>";
stream.write(s1.getBytes());
stream.flush();
Thread.sleep(1000);
stream.write(s2.getBytes());
stream.flush();
I am getting correctly
startDocument()
startElement() for stream
startElement() for element
endElement() for element
endElement() for stream
but
to get endDocument() stream.close() is necessary
I am not sure what standard java 1.4 SAX parser will do.
--
Best regards
Maxym Gorodetskyy
More information about the JDev
mailing list