On Thu, 2003-11-06 at 18:03, jcplerm wrote:
> I guess throwing an exception is a pretty good suggestion that I try out.
> 
> Sorry for my ignorance, but is there any XML pull parser that is already
> available in Cocoon?

not that I know of.

> Or would this require still some integration effort?

Yep. Basically you would need to create a custom generator that pull
parses a file and only sends the events of interest down the pipeline.
Make sure though the events are nicely balanced, i.e. for each
startElement there should be a corresponding endElement call, etc. Also
beware of possible differences in conventions of what the definitions of
namespaceURI, localName and qName are. (e.g. in SAX an empty namespace
is represented by an empty string while in DOM it is null)

> 
> jlerm
> 
> ----- Original Message ----- 
> From: "Bruno Dumon" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, November 06, 2003 10:46 AM
> Subject: Re: Stopping a SAX parser
> 
> 
> > On Thu, 2003-11-06 at 17:36, David Kavanagh wrote:
> > > If I'm not mistaken, you can call endDocument() in your own
> > > transformer at any time. That effectively puts an end to pipeline
> > > processing.
> >
> > But that won't stop the parser from parsing the rest of the file and
> > pushing SAX events out.
> >
> > The only way of stopping a SAX-parser is throwing an exception.
> >
> > Using a pull-parser you can decide yourself when you stop reading.
> >
> > >  Hopefully, at that point, you've also genereated events for some
> > > sending some data out of your transformer!
> > >
> > > David
> > >
> > > jcplerm wrote:
> > > > I'm not sure which list to post this question to, but maybe one of
> > > > you know if it's possible at all to stop a SAX parser once the
> > > > immediate content handler finds whatever info it is looking for, in
> > > > order to avoid unnecessary parsing of the rest of a potentially
> > > > large XML document?
> > > >
> > > > Thanks,
> > > >
> > > > jlerm
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to