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 Ingo Assenmacher <In...@post.rwth-aachen.de> on 2000/06/14 18:07:24 UTC

Error indicated, no exception thrown

Hi!

I use a DOMparser right from the scratch (I use DOMPrint.cpp as a basis for
this).
I installed an error handler, set validation to true and, yes! I do get an
error: For example:

<!ATTLIST property
          name   NMTOKEN                    #IMPLIED>

within my DTD and:

<property Name="text">Please.</property>
which is wrong, since Name starts with an uppercase letter.

This is the code-sequence from DOMPrint.cpp:

    try    {
        parser.parse(xmlFile);    }

    catch (const XMLException& e)    {
        cerr << "An error occured during parsing\n   Message: "
            << DOMString(e.getMessage()) << endl;
        errorsOccured = true;
   }

which I thought would catch this.
This is what I do get as an output:

Error at file "filename", line 23, column 28
   Message: Attribute 'Name' is not declared for element 'property'

But there is no exception thrown up to the top-level, which results in no
exit/error condition and my client works on the partially built tree.
a) why is this? (where did I go wrong?)
b) can I do an check, for example on DOMParser to take a peek if the tree
has been built properly?

Thank you very very much for your response.

Regards, Ingo.




Re: Error indicated, no exception thrown

Posted by Dean Roddey <dr...@charmedquark.com>.
The error went to the error handler. Exceptions are only thrown for
catastrophic failures. Your error handle can keep a count of errors that's
its seen. When you come back from parse(), check that count and see if any
errors occured.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message ----- > Hi!
>
> I use a DOMparser right from the scratch (I use DOMPrint.cpp as a basis
for
> this).
> I installed an error handler, set validation to true and, yes! I do get an
> error: For example: