At 17.12 22/05/2007 +0530, Pranav, Savkur wrote:
Hello Alberto, thanks for the replies
        I have implemented a class that has derived from DOMErrorHandler
and implemented the handleError method of that class.
Is this fine or the ErrorHandler interface itself must be implemented?

The DOMErrorHandler should be used with the DOMBuilder parser; the ErrorHandler should be used with the XercesDOMParser parser.
They do the same job, but are different interfaces.

Alberto


Regards,
Pranav



-----Original Message-----
From: ext Alberto Massari [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 22, 2007 4:45 PM
To: Pranav, Savkur
Cc: [email protected]
Subject: RE: Xerces C++ xsd schema validation

Hi Pranav,

At 16.31 22/05/2007 +0530, Pranav, Savkur wrote:
>Hello Alberto,
>
>         Is this to be done using the
>setErrorHandler API of XercesDOMParser?

Yes

>         Once the validation fails, must a call be made to one of the
>errorhandler methods or is the call eventbased?

You need to declare a class deriving from the ErrorHandler interface,
and implement its virtual methods; the XML engine will call the
warning(), error() or fatalError() method of the interface whenever an
error occurs. You can then throw a custom exception to abort parsing, or
simply store the message in the class and let the XML engine try to
continue parsing/validating.

Alberto


>Regards,
>Pranav
>
>-----Original Message-----
>From: ext Alberto Massari [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, May 22, 2007 3:35 PM
>To: Pranav, Savkur
>Cc: [email protected]
>Subject: Re: Xerces C++ xsd schema validation
>
>Hi Pranav,
>if you want to see the errors, you need to register an ErrorHandler.
>
>Alberto
>
>At 15.15 22/05/2007 +0530, Pranav, Savkur wrote:
>
> >Hello Alberto,
> >         where can I get code samples that have schema validation of
> >an XML file against an XSD?
> >I'm doing these in my code but the validation does not show any
errors:
> >
> >
>m_pDOMParser->setExternalNoNamespaceSchemaLocation(strSchemaFile);
> >         //Get all errors
> >         m_pDOMParser->setExitOnFirstFatalError(true);
> >         //All validation errors are fatal.
> >         m_pDOMParser->setValidationConstraintFatal(true);
> >         //Set the validation scheme
> >
> >m_pDOMParser->setValidationScheme(XERCES_CPP_NAMESPACE::XercesDOMPars
> >er
> >::Val_Auto
> >);
> >         //Set schema validation
> >         m_pDOMParser->setValidationSchemaFullChecking(false);
> >         //Use namespaces and schema
> >         m_pDOMParser->setDoNamespaces(true);
> >         m_pDOMParser->setDoSchema(true);
> >
> >         m_pDOMParser->setIncludeIgnorableWhitespace(false);
> >
> >Regards,
> >Pranav
> >
> >Disclaimer:
> >This e-mail may contain trade secrets or privileged, undisclosed or
> >otherwise confidential information. If you have received this e-mail
> >in
>
> >error, you are hereby notified that any review, copying or
> >distribution
>
> >of it is strictly prohibited. Please inform us immediately and
> >destroy the original transmittal. Thank you for your cooperation.
>
>
>
>
>Disclaimer:
>This e-mail may contain trade secrets or privileged, undisclosed or
>otherwise confidential information. If you have received this e-mail in

>error, you are hereby notified that any review, copying or distribution

>of it is strictly prohibited. Please inform us immediately and destroy
>the original transmittal. Thank you for your cooperation.




Disclaimer:
This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

Reply via email to