[JDEV] Using Java Socket and JAXP1.1 DefaultHandler

Chris Chen ckchris at idream.net
Tue Oct 9 02:29:00 CDT 2001


Yea, I encountered this problem myself as well when I was developing the 
Jabber API.

Essentially, the XML Parser doesn't know exactly how to parse the data 
based on the encoding.. The way I got it to work is to wrap the output and 
input streams of the socket inside BufferedReader and BufferedWriter (with 
encoding UTF8 since Jabber by default uses UTF8).

This apparently worked for me.. If you would like to see what's up, you can 
look at my Jabber API source code (look at the class 
com.echomine.jabber.JabberProtocol).

http://www.echomine.org/projects/muse/

You can download the source and take a look

Thanks,
Chris

At 11:16 PM 10/8/2001, you wrote:
>Hi,
>I'm having a problem using the Java Socket object and the JAXP1.1 
>SAXParser DefaultHandler. To post all the code would make for a really 
>long post so I'm hoping an explaination will be sufficient. I connect ok 
>to jabber.org but it seems that my handler for the <stream:stream> element 
>doesn't get processed by the parser until the end element is captured, 
>i.e. by sending "</stream:stream>" to the server, making it impossible to 
>capture the initialization success event (by processing the 
><stream:stream> starting element) and thus making it impossible to process 
>an xml conversation. Has anyone one seen this or I am I doing something 
>wrong along the way somewhere.
>
>Thanks, John
>

PGP at ldap://certserver.pgp.com/




More information about the JDev mailing list