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 el...@ni.com on 2003/06/12 21:55:56 UTC

DOMException enum

I am having trouble using the enum associated with the DOMException.  I
would certainly prefer to use the enum when error checking than the numeric
equivalent.  Here is a simplified example of my problem:

try
            {
                  DOMEntityReference*     testRef =
doc->createEntityReference(amp);
            }
            catch(DOMException e)
            {

                  if(e.code == DOMSTRING_SIZE_ERR)
                        cout<<"Some particularly helpful message"<<endl;
            }

Whenver I try to compile this I get

C:
\wormholeitk\supportfiles\plat\xerces-c2_2_0-win32\samples\CreateDOMDocument\CreateDOMDocument.cpp(220)

: error C2065: 'DOMSTRING_SIZE_ERR' : undeclared identifier
Error executing cl.exe.

Error 2065 is as follows:

The specified identifier was not declared.  A variable's type must be
specified in a declaration before it can be used. The parameters that a
function uses must be specified in a declaration, or prototype, before the
function can be used.

What am I missing here?


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


Re: DOMException enum

Posted by da...@us.ibm.com.



> I am having trouble using the enum associated with the DOMException.  I
> would certainly prefer to use the enum when error checking than the
numeric
> equivalent.  Here is a simplified example of my problem:
>
> try
>             {
>                   DOMEntityReference*     testRef =
> doc->createEntityReference(amp);
>             }
>             catch(DOMException e)
>             {
>
>                   if(e.code == DOMSTRING_SIZE_ERR)
>                         cout<<"Some particularly helpful message"<<endl;
>             }

Do you really mean to catch that exception by value?  Why not by const
reference?

             catch(const DOMException& e)
             {

                   if(e.code == DOMException::DOMSTRING_SIZE_ERR)
                         cout<<"Some particularly helpful message"<<endl;
             }

The enum is declared withing the DOMException class, so it is within that
scope.

Dave


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