xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dane Foster" <dfos...@equitytg.com>
Subject Re: stopping the SAX parser
Date Thu, 01 Feb 2001 15:34:10 GMT
Throw a SAXException.

ex.

try
{
    parser.parse( new InputSource( someURI ) );
}
catch( SAXException sax )
{
    if( sax.getMessage().equals( "My condition is true so stop parsing" ) )
    {
        //do any necessary cleanup or whatever you want to do
    }
}


public void endElement( String ns, String localName, String nsName ) throws
SAXException
{
    if( myTestCondition == true ) throw new SAXException( "My condition is
true so stop parsing" );
}


Dane Foster
Equity Technology Group, Inc
http://www.equitytg.com.


----- Original Message -----
From: "Roberto Tiella" <tiella@sodalia.it>
To: "xml mailing list" <general@xml.apache.org>
Sent: Thursday, February 01, 2001 6:17 AM
Subject: stopping the SAX parser


Hi,

I would like to stop the SAX parser in a endElement method in
DocumentHandler when a certain condition occours to avoid further
parsing, any suggestions ?

thanks, roberto.

--
Roberto Tiella
Process Reuse And Technologies Area
SODALIA s.p.a.
v. Valentina Zambra,1 38100 TRENTO ITALY
phone: +39 0461 316430 fax: +39 0461 316401



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