I needed to do something similar to this.  What I ended up doing was to
first write a <ROOT> string to the stream and finish with a </ROOT>.  In
between, I send <MSG> elements.  Whenever the SAX handler hits a </MSG>,
it takes the object it has built up and hands it off to somebody else.
By starting off with <ROOT>, the parser doesn't see an end-of-document
until I'm ready to close and I send the </ROOT>.  Not the prettiest way
to do things, but it works.  (I'd love to have a DOM reader that could
take multiple documents.)  

<ROOT>
        <MSG>
        ...
        </MSG>
        <MSG>
        ...
        </MSG>
</ROOT>

> -----Original Message-----
> From: Adrian Brogan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 11, 2000 10:15 AM
> To: '[EMAIL PROTECTED]'
> Subject: SAX parser: Multiple documents from a single stream
> 
> 
> If the SAX parser is taking input from a continuous stream of 
> data, is there
> a way to configure/use/get the SAX parser to stop at the 
> start of each new
> document on the stream ?
> 
> I.e. what i want to do is parse one document, then do some of my own
> processing on it, then return to the SAX parser and repeat 
> this process.
> 
> Thanks
> 
> Adrian
> --------------------------------------------------------------
> ---------
> Adrian Brogan (Development Team Leader)
> E-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

Reply via email to