You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Fredrick Paul Eisele <ph...@netarx.com> on 2002/04/11 16:14:18 UTC

How to break out of SAX?

I am using the SAX parser to pick out a particular element.
Once I have the element (and its attributes) there is no
reason to finish parsing the document.
Presently, I am using die to throw an exception which
terminates the parser.
Although this technique works I don't like it.
Does anyone know how to break out?


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: How to break out of SAX?

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Steven N. Hirsch" <hi...@btv.ibm.com> writes:

> On Thu, 11 Apr 2002, Fredrick Paul Eisele wrote:
> 
> > I am using the SAX parser to pick out a particular element.
> > Once I have the element (and its attributes) there is no
> > reason to finish parsing the document.
> > Presently, I am using die to throw an exception which
> > terminates the parser.
> > Although this technique works I don't like it.
> > Does anyone know how to break out?
> 
> I _think_ you can use parseFirst and parseNext until you've seen what you 
> need to.  Just conjecture, since I've not used those functions myself.

Yup, you need to use progressive parsing. t/SAXParser.t has a short
example of how to use it.

jas.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: How to break out of SAX?

Posted by "Steven N. Hirsch" <hi...@btv.ibm.com>.
On Thu, 11 Apr 2002, Fredrick Paul Eisele wrote:

> I am using the SAX parser to pick out a particular element.
> Once I have the element (and its attributes) there is no
> reason to finish parsing the document.
> Presently, I am using die to throw an exception which
> terminates the parser.
> Although this technique works I don't like it.
> Does anyone know how to break out?

I _think_ you can use parseFirst and parseNext until you've seen what you 
need to.  Just conjecture, since I've not used those functions myself.

Steve

-- 
----------------------------------------------------------------
Steven N. Hirsch       tie-line: 446-6557     ext: 802-769-6557

Staff Engineer                     Methodology Integration Team
ASIC Product Development           IBM Microelectronics
----------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org