Emmanuel Guiton wrote:
Well, I didn't learn more ...
Here is the code I use:

XercesDOMParser* parser = new XercesDOMParser();

parser->setDoValidation(true);
parser->setDoSchema(true);
parser->setDoNamespaces(true);
parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setExternalSchemaLocation ( "http://www.elodig.fr/logs
file:///path/schema.xsd" );

try
{
   parser->parse ( xmlFile );
}
catch (const OutOfMemoryException& toCatch )
{
...

And I don't catch any error (see the xml and xsd file at the bottom :
there are errors in the xml file).

Errors are reported through an ErrorHandler instance. From XercesDOMParser.hpp:

    /** Set the error handler
      *
      * This method allows applications to install their own error handler
      * to trap error and warning messages.
      *
      * <i>Any previously set handler is merely dropped, since the parser
      * does not own them.</i>
      *
      * @param handler  A const pointer to the user supplied error
      *                 handler.
      *
      * @see #getErrorHandler
      */
    void setErrorHandler(ErrorHandler* const handler);

If you don't set an ErrorHandler, errors are simply ignored. Take a look at the DOMPrint sample for more information.

Dave

Reply via email to