|
|
|||
File indexing completed on 2025-12-15 10:32:52
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_ERRORHANDLER_HPP) 0023 #define XERCESC_INCLUDE_GUARD_ERRORHANDLER_HPP 0024 0025 #include <xercesc/util/XercesDefs.hpp> 0026 0027 XERCES_CPP_NAMESPACE_BEGIN 0028 0029 class SAXParseException; 0030 0031 0032 /** 0033 * Basic interface for SAX error handlers. 0034 * 0035 * <p>If a SAX application needs to implement customized error 0036 * handling, it must implement this interface and then register an 0037 * instance with the SAX parser using the parser's setErrorHandler 0038 * method. The parser will then report all errors and warnings 0039 * through this interface.</p> 0040 * 0041 * <p> The parser shall use this interface instead of throwing an 0042 * exception: it is up to the application whether to throw an 0043 * exception for different types of errors and warnings. Note, 0044 * however, that there is no requirement that the parser continue to 0045 * provide useful information after a call to fatalError (in other 0046 * words, a SAX driver class could catch an exception and report a 0047 * fatalError).</p> 0048 * 0049 * <p>The HandlerBase class provides a default implementation of this 0050 * interface, ignoring warnings and recoverable errors and throwing a 0051 * SAXParseException for fatal errors. An application may extend 0052 * that class rather than implementing the complete interface 0053 * itself.</p> 0054 * 0055 * @see Parser#setErrorHandler 0056 * @see SAXParseException#SAXParseException 0057 * @see HandlerBase#HandlerBase 0058 */ 0059 0060 class SAX_EXPORT ErrorHandler 0061 { 0062 public: 0063 /** @name Constructors and Destructor */ 0064 //@{ 0065 /** Default constructor */ 0066 ErrorHandler() 0067 { 0068 } 0069 0070 /** Destructor */ 0071 virtual ~ErrorHandler() 0072 { 0073 } 0074 //@} 0075 0076 /** @name The error handler interface */ 0077 //@{ 0078 /** 0079 * Receive notification of a warning. 0080 * 0081 * <p>SAX parsers will use this method to report conditions that 0082 * are not errors or fatal errors as defined by the XML 1.0 0083 * recommendation. The default behaviour is to take no action.</p> 0084 * 0085 * <p>The SAX parser must continue to provide normal parsing events 0086 * after invoking this method: it should still be possible for the 0087 * application to process the document through to the end.</p> 0088 * 0089 * @param exc The warning information encapsulated in a 0090 * SAX parse exception. 0091 * @exception SAXException Any SAX exception, possibly 0092 * wrapping another exception. 0093 * @see SAXParseException#SAXParseException 0094 */ 0095 virtual void warning(const SAXParseException& exc) = 0; 0096 0097 /** 0098 * Receive notification of a recoverable error. 0099 * 0100 * <p>This corresponds to the definition of "error" in section 1.2 0101 * of the W3C XML 1.0 Recommendation. For example, a validating 0102 * parser would use this callback to report the violation of a 0103 * validity constraint. The default behaviour is to take no 0104 * action.</p> 0105 * 0106 * <p>The SAX parser must continue to provide normal parsing events 0107 * after invoking this method: it should still be possible for the 0108 * application to process the document through to the end. If the 0109 * application cannot do so, then the parser should report a fatal 0110 * error even if the XML 1.0 recommendation does not require it to 0111 * do so.</p> 0112 * 0113 * @param exc The error information encapsulated in a 0114 * SAX parse exception. 0115 * @exception SAXException Any SAX exception, possibly 0116 * wrapping another exception. 0117 * @see SAXParseException#SAXParseException 0118 */ 0119 virtual void error(const SAXParseException& exc) = 0; 0120 0121 /** 0122 * Receive notification of a non-recoverable error. 0123 * 0124 * <p>This corresponds to the definition of "fatal error" in 0125 * section 1.2 of the W3C XML 1.0 Recommendation. For example, a 0126 * parser would use this callback to report the violation of a 0127 * well-formedness constraint.</p> 0128 * 0129 * <p>The application must assume that the document is unusable 0130 * after the parser has invoked this method, and should continue 0131 * (if at all) only for the sake of collecting addition error 0132 * messages: in fact, SAX parsers are free to stop reporting any 0133 * other events once this method has been invoked.</p> 0134 * 0135 * @param exc The error information encapsulated in a 0136 * SAX parse exception. 0137 * @exception SAXException Any SAX exception, possibly 0138 * wrapping another exception. 0139 * @see SAXParseException#SAXParseException 0140 */ 0141 virtual void fatalError(const SAXParseException& exc) = 0; 0142 0143 /** 0144 * Reset the Error handler object on its reuse 0145 * 0146 * <p>This method helps in reseting the Error handler object 0147 * implementation defaults each time the Error handler is begun.</p> 0148 * 0149 */ 0150 virtual void resetErrors() = 0; 0151 0152 0153 //@} 0154 0155 private : 0156 /* Unimplemented constructors and operators */ 0157 0158 /* Copy constructor */ 0159 ErrorHandler(const ErrorHandler&); 0160 0161 /* Assignment operator */ 0162 ErrorHandler& operator=(const ErrorHandler&); 0163 0164 }; 0165 0166 XERCES_CPP_NAMESPACE_END 0167 0168 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|