Title: Separate MemBufInputSource as input
We had
the same issue.
Here
are three ideas for consideration:
Derive a new InputSource that gets its
data from your incoming buffers and knows where buffers with more data come
from. Your new InputSource would block when it runs out of data and that
will stop the parse until more data arrives. In our case, another thread
received the buffers and passed them to the InputSource through an anonymous
pipe.
If its
OK to delay parsing until you know all the data has arrived, you could just
create a list of MemBufInputSources and use them to create a master
MemBufInputSource once you know the stream is complete. This would be much
simpler to write, but assumes that you have some way to know when the last
buffer has arrived. If you're picking XML buffers off of a network, you
know the stream is complete when the network connection is
closed.
Its
possible that you could use the progressive parsing feature, but I think it
would be messy. Basically, the strategy would be to check the amount of
data remaining in the input buffer every time you get control back from the
parser. If your're running low, go get more and add it to the end. I
don't know if you can extend a MemBufInputSource. If not, you'll have to
derive an extendible one.
-----Original Message-----
From:
Williamson, Siehnai [mailto:[EMAIL PROTECTED]]
Sent: Friday,
June 22, 2001 11:19 AM
To:
'[EMAIL PROTECTED]'
Subject: Separate MemBufInputSource as
input
Hi,
I am using the MemBufInputSource as my input source
for the SAX parser. However, my application will have to stream the data
piecemeal as separate MemBufInputSource's to the SAX parser because of the
size of the input files.
For instance, a MemBufInputSource will
represent only a chunk of the actual xml file. When the SAX parser
reaches the end of that memory buffer, it will need to wait for the next
MemBufInputSource to continue parsing rather than ending the parse or giving
an error. Is there a way for the SAX parser to parse one buffer, wait,
then parse another buffer, wait, and so on, until you tell the parser that
this is the last buffer?
Siehnai Williamson
DocuCorp International, Inc.