[JDEV] Question on using NIO with SAX

Chan, Oscar OChan at pogo.com
Thu Mar 21 19:37:52 CST 2002


Thanks. I guess I will have to live with this until the SAX API provide API
for this push-model parser.  

I looked at the Xerces-J parser's parseSome() method, but it is only for
parsing the first line of XML document to get the encoding in XML
Declaration, so it does not work in the way that I needed.

Thanks again,

Oscar

-----Original Message-----
From: David Waite [mailto:mass at akuma.org]
Sent: Thursday, March 21, 2002 5:16 PM
To: jdev at jabber.org
Subject: Re: [JDEV] Question on using NIO with SAX


This is an issue with the SAX Api (which understandably, we can't 
change). What you want is a push-model parser (like SAX) which takes a 
block of bytes/characters and calls events on the DocumentHandler (on 
that thread) until that block of data has been processed, then returns 
or saves the remainder until the next time it is passed.  SAX does not 
define this, and anything which does this at least is extending SAX.

I believe Xerces-J at least defines a parseSome method on its XmlParser 
method, but I don't know if this does what you want.

-David Waite

Chan, Oscar wrote:

> Hi all,
>
> I am new here.  I am now developing a message server based on the 
> subset of Jabber protocol. I am building using Java, and SAX parser in 
> javax.xml.parsers package.   My problem is that I am trying to code 
> the server so that it can use NIO (new i/o) package once java 1.4 is 
> stable enough to use.  By using NIO, it eliminates the problem of 
> having a thread per socket because it multiplexes the input and store 
> the data in a buffer instead of blocking the call and waiting until 
> data is available.  Usually, the server machine will slow down when 
> the number of thread reach about 1000.  Therefore, NIO will increase 
> the number of connection that we can have. 
>
> Since parse() method in java.xml.parsers.SAXParser is using a blocking 
> I/O and, hence, it increase the number of threads. Does anyone know 
> any workaround for it, or any future support for SAX using NIO?
>
> Thanks
>
> Oscar
>



_______________________________________________
jdev mailing list
jdev at jabber.org
http://mailman.jabber.org/listinfo/jdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20020321/861ab2be/attachment-0002.htm>


More information about the JDev mailing list