summaryrefslogtreecommitdiff
path: root/ACEXML/common/ErrorHandler.h
blob: 00d793841dba3634852f21c751ffdcbeb640e2f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// -*- C++ -*-

//=============================================================================
/**
 *  @file    ErrorHandler.h
 *
 *  $Id$
 *
 *  @author Nanbor Wang <nanbor@cs.wustl.edu>
 */
//=============================================================================
#ifndef _ACEXML_ERRORHANDLER_H_
#define _ACEXML_ERRORHANDLER_H_

#include "ace/pre.h"
#include "ACEXML/common/ACEXML_Export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ACEXML/common/Env.h"
#include "ACEXML/common/SAXExceptions.h"

/**
 * @class ACEXML_ErrorHandler ErrorHandler.h "ACEXML/common/ErrorHandler.h"
 *
 * @brief ACEXML_ErrorHandler
 *
 * 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 setErrorHandler method. The parser will
 * then report all errors and warnings through this interface.
 *
 * @b WARNING: If an application does not register an ErrorHandler,
 * XML parsing errors will go unreported and bizarre behaviour may
 * result.
 *
 * For XML processing errors, a SAX driver 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
 * parser continue to provide useful information after a call to
 * fatalError (in other words, a SAX driver class could catch an
 * exception and report a fatalError).
 */
class ACEXML_Export ACEXML_ErrorHandler
{
public:
  /**
   * Receive notification of a recoverable error.
   */
  virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
        ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;

  /**
   * Receive notification of a non-recoverable error.
   */
  virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
        ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;

  /**
   * Receive notification of a warning.
   */
  virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
        ACE_THROW_SPEC ((ACEXML_SAXException)) = 0;
};


#include "ace/post.h"

#endif /* _ACEXML_ERRORHANDLER_H_ */