xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <as...@cs.indiana.edu>
Subject Re: How to start writing a non-blocking SAX parser
Date Sun, 28 Apr 2002 15:25:37 GMT
Miguel A Paraz wrote:

> Thanks! However you posted code for Xerces C++, while I'm using Xerces
> Java 2.  In Java, InputSource does not have makeStream(), nor does it have
> a BinInputStream class.
>
> Does this mean that Xerces-J does not allow a different kind of InputSource,
> and any customization has to conform to a InputStream or a Reader?

the problem is not in input stream or reader but in how to set
SAX property /feature to request non-blocking parsing.

here is a code fragment that does it for Xerces 2 XNI (it is _not_ SAX though):

        import org.apache.xerces.parsers.StandardParserConfiguration;
        import org.apache.xerces.xni.parser.XMLPullParserConfiguration;

        XMLPullParserConfiguration pullParserConfiguration = new StandardParserConfiguration();
        pullParserConfiguration.setDocumentHandler(this);
        pullParserConfiguration.setErrorHandler(this);

and then call:

        pullParserConfiguration.parse(false)

this function will deliver one callback and return (true indicates that more input is availabel,
false is returned when parsing is finished).

hope it helps,

alek



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message