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 David Kirwan <DK...@baltimore.com> on 2000/05/22 18:42:50 UTC

parse throws exception, but SAX and XMLException are not being ca ught

Hi,

I'm getting a minor problem.
When I call parser.parse()
I get an exception if the XML contains a ID ref that
does not exist. For example, I have DUMMY1 and DUMMY2
as ID's I could refer to. If I try to reference NO_SUCH_DUMMY
when I call the parse() function, I get an unhandled exception.

The elipise catches it, but thats not much help, it stops it blowing
up. But I cannot get an useful information out of it.

Any help would be apprecaited,
DaveK

try
        {
            parser.parse((const _TCHAR*)filename);
        }
        catch (const XMLException& e)
        {
            STD::cout << "An error occured during parsing\n   Message: ";
        }
        catch (const SAXException& e)
        {
            STD::cout << "An error occured during parsing\n   Message: ";
        }
        catch (const DOM_ DOMException& e)
        {
            STD::cout << "An error occured during parsing\n   Message: ";
        }
        catch (...)
        {
            STD::cout << "An error occured during parsing\n   Message: ";//
<< e.getMessage();//.transcode();
        }

Re: parse throws exception, but SAX and XMLException are not being caught

Posted by Dean Roddey <dr...@charmedquark.com>.
That exception should be getting caught in XMLScanner, so I'm not sure
what's going on. If you look in XMLScanner::scanContent(), the call to
checkIDRefs() is within the try/catch block that wraps all of the parsing
operation.

I would imagine that you are really seeing a system exception, i.e.
something really bad is happening and its trapping. scanContent(), if it
gets any unknown exception, will issue an error through the error handler
and then rethrow it.

Are you using our binary drop, or is this a build of the system of your own?
Are you using a sample of ours, or some code of your own? What version are
you using, what platform, etc...

--------------------------
Dean Roddey
The CIDLib Class Libraries
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"Give me immortality, or give me death"

----- Original Message -----
From: "David Kirwan" <DK...@baltimore.com>
To: <xe...@xml.apache.org>
Sent: Monday, May 22, 2000 9:42 AM
Subject: parse throws exception, but SAX and XMLException are not being
caught


> Hi,
>
> I'm getting a minor problem.
> When I call parser.parse()
> I get an exception if the XML contains a ID ref that
> does not exist. For example, I have DUMMY1 and DUMMY2
> as ID's I could refer to. If I try to reference NO_SUCH_DUMMY
> when I call the parse() function, I get an unhandled exception.
>