Unicorn XML Toolkit
Version 1.50.00

Namespace Sax
Class CErrorHandler

class CErrorHandler: virtual public CInterface {
public:
    CErrorHandler();
    virtual ~CErrorHandler();
public:
    virtual void Warning(CSaxParseException *pException) = 0;
    virtual void Error(CSaxParseException *pException) = 0;
    virtual void FatalError(CSaxParseException *pException) = 0;
    };
typedef XInterface<CErrorHandler> XErrorHandler;

The basic interface for SAX error handlers.

If a SAX application needs to implement customized error handling, it must implement this interface and then register an instance with the XML reader using the CXmlReader::SetErrorHandler method. The reader will then report all errors and warnings through this interface.

WARNING: If an application does not register an error handler, XML parsing errors will go unreported and bizarre behaviour may result.

For XML processing errors, a SAX reader must use this interface instead of throwing an exception: it is up to the application to decide whether to throw an exception for different types of errors and warnings. Note, however, that there is no requirement that the reader continue to provide useful information after a call to FatalError (in other words, a SAX reader class could catch an exception and report a fatal error).

Since:
1.00.00
Version:
1.50.00
Author:
C++ interfaces by Alexey Gokhberg; based on the original SAX2 specification by David Megginson
See Also:
CSaxParseException
Constructor/Destructor Summary
CErrorHandler ();
����������Constructs the error handler.
~CErrorHandler ();
����������Destroys the error handler.

Function Summary
void Warning (CSaxParseException *pException);
����������Receives notification of a warning.
void Error (CSaxParseException *pException);
����������Receives notification of a recoverable error.
void FatalError (CSaxParseException *pException);
����������Receives notification of a non-recoverable error.

Constructor/Destructor Detail

CErrorHandler

CErrorHandler();

Constructs the error handler.

~CErrorHandler

virtual ~CErrorHandler();

Destroys the error handler.

Function Detail

Warning

virtual void Warning(CSaxParseException *pException) = 0;

Receives notification of a warning.

SAX readers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The default behaviour is to take no action.

The SAX reader must continue to provide normal events after invoking this method: it should still be possible for the application to process the document through to the end.

Filters may use this method to report other, non-XML warnings as well.

Parameters:
pException - the SAX parse exception containing the warning information

Error

virtual void Error(CSaxParseException *pException) = 0;

Receives notification of a recoverable error.

This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a reader implementing a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.

The SAX reader must continue to provide normal events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the reader should report a fatal error even if the XML 1.0 recommendation does not require it to do so.

Filters may use this method to report other, non-XML errors as well.

Parameters:
pException - the SAX parse exception containing the error information

FatalError

virtual void FatalError(CSaxParseException *pException) = 0;

Receives notification of a non-recoverable error.

This corresponds to the definition of "fatal error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a reader would use this callback to report the violation of a well-formedness constraint.

The application must assume that the document is unusable after the reader has invoked this method, and should continue (if at all) only for the sake of collecting addition error messages: in fact, SAX readers are free to stop reporting any other events once this method has been invoked.

Parameters:
pException - the SAX parse exception containing the error information

Unicorn XML Toolkit
Version 1.50.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.