You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Simon Kitching <si...@ecnetwork.co.nz> on 2004/07/16 03:44:33 UTC
Throwing exceptions from EntityResolver
Hi,
I've created a class which implements the EntityResolver interface.
In the resolveEntity method, I just throw SAXParseException; because I
don't have a local catalog and don't want to allow network lookups, I
want to treat any attempt to reference an external entity from the
parsed xml as an error.
The documentation for EntityResolver::resolveEntity says that
SAXException can be thrown.
However when I parse a document which does attempt an external entity
reference, my EntityResolver code gets invoked as expected, and the
SAXParseException gets thrown. This ends up causing *some* kind of
exception to be thrown from the SAX2XMLReader::parse method, but I can't
figure out what it is.
I've tried catching all of the following, but they all get skipped; only
catch(...) is collecting the mystery exception:
XMLException
SAXException
OutOfMemory
IOException
EndOfEntityException // wild guess
DOM_DOMException // wild guess
DOMException // wild guess
int, short
I tried the int/short because I see xerces code sometimes throws enum
constants (??!!) and on occasions even the value 0 (!).
Any ideas what this exception might be, or how I could find out what it
is?
Thanks,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Throwing exceptions from EntityResolver
Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Fri, 2004-07-16 at 13:44, Simon Kitching wrote:
> Hi,
>
> I've created a class which implements the EntityResolver interface.
>
> In the resolveEntity method, I just throw SAXParseException; because I
> don't have a local catalog and don't want to allow network lookups, I
> want to treat any attempt to reference an external entity from the
> parsed xml as an error.
>
> The documentation for EntityResolver::resolveEntity says that
> SAXException can be thrown.
>
> However when I parse a document which does attempt an external entity
> reference, my EntityResolver code gets invoked as expected, and the
> SAXParseException gets thrown. This ends up causing *some* kind of
> exception to be thrown from the SAX2XMLReader::parse method, but I can't
> figure out what it is.
Sorry, issue resolved and it is my fault.
It's been far too long since I used c++, and I fell into a Java-ism:
throw new SAXParseException(....)
when it should have been:
throw SAXParseException(....)
The mystery exception type was therefore: pointer-to-SAXParseException
:-(.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org