xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: continuous document; sax
Date Tue, 07 Aug 2001 03:37:29 GMT
Duane Stoddard wrote:
> The Xerces FAQ actually contains information on how to do this 
> also (they have an additional requirement in that you should
> also implement your own StreamingCharFactory, but see that 
> FAQ for more information about this).

Xerces2 doesn't have this read-entire-buffer-before-doing-anything
problem. It will take whatever it can get (even if that's only a
character at a time) and process it.

> For our purposes, we use our own reader which extends the 
> BufferedReader class. I have attached this class so you can see 
> how we handle it. 

These types of solutions are perfect when you know the encoding
of the stream ahead of time. If you don't, then you really 
shouldn't try to auto-detect all of the various encodings your-
self because it can be error prone.

If you don't know the encoding, then your best bet is to write
some kind of protocol into the stream so that the receiver can
detect the end-of-file and pretend to close the stream so that
the parser can continue. 

> The licensing agreement uses a GPL style license - so 

If you're leary of the GPL kind of license and want to employ
a solution such as the one I stated earlier, there is a sample 
with Xerces2 that provides the arbitrary length data solution 
when you don't even know the original length of the document 
up front. However, it requires you to have control over the 
writer and reader of the data to actually do the protocol but
the classes handle it automatically when you use them.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

---------------------------------------------------------------------
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