[2674] | 1 | /* |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | * this work for additional information regarding copyright ownership. |
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | * (the "License"); you may not use this file except in compliance with |
---|
| 7 | * the License. You may obtain a copy of the License at |
---|
| 8 | * |
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | * |
---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | * See the License for the specific language governing permissions and |
---|
| 15 | * limitations under the License. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | /* |
---|
| 19 | * $Id: SAXParseException.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #ifndef SAXPARSEEXCEPTION_HPP |
---|
| 24 | #define SAXPARSEEXCEPTION_HPP |
---|
| 25 | |
---|
| 26 | #include <xercesc/sax/SAXException.hpp> |
---|
| 27 | |
---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 29 | |
---|
| 30 | class Locator; |
---|
| 31 | |
---|
| 32 | /** |
---|
| 33 | * Encapsulate an XML parse error or warning. |
---|
| 34 | * |
---|
| 35 | * <p>This exception will include information for locating the error |
---|
| 36 | * in the original XML document. Note that although the application |
---|
| 37 | * will receive a SAXParseException as the argument to the handlers |
---|
| 38 | * in the ErrorHandler interface, the application is not actually |
---|
| 39 | * required to throw the exception; instead, it can simply read the |
---|
| 40 | * information in it and take a different action.</p> |
---|
| 41 | * |
---|
| 42 | * <p>Since this exception is a subclass of SAXException, it |
---|
| 43 | * inherits the ability to wrap another exception.</p> |
---|
| 44 | * |
---|
| 45 | * @see SAXException#SAXException |
---|
| 46 | * @see Locator#Locator |
---|
| 47 | * @see ErrorHandler#ErrorHandler |
---|
| 48 | */ |
---|
| 49 | class SAX_EXPORT SAXParseException : public SAXException |
---|
| 50 | { |
---|
| 51 | public: |
---|
| 52 | /** @name Constructors and Destructor */ |
---|
| 53 | //@{ |
---|
| 54 | /** |
---|
| 55 | * Create a new SAXParseException from a message and a Locator. |
---|
| 56 | * |
---|
| 57 | * <p>This constructor is especially useful when an application is |
---|
| 58 | * creating its own exception from within a DocumentHandler |
---|
| 59 | * callback.</p> |
---|
| 60 | * |
---|
| 61 | * @param message The error or warning message. |
---|
| 62 | * @param locator The locator object for the error or warning. |
---|
| 63 | * @param manager Pointer to the memory manager to be used to |
---|
| 64 | * allocate objects. |
---|
| 65 | * @see Locator#Locator |
---|
| 66 | * @see Parser#setLocale |
---|
| 67 | */ |
---|
| 68 | SAXParseException(const XMLCh* const message, const Locator& locator, |
---|
| 69 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Create a new SAXParseException. |
---|
| 74 | * |
---|
| 75 | * <p>This constructor is most useful for parser writers.</p> |
---|
| 76 | * |
---|
| 77 | * <p>If the system identifier is a URL, the parser must resolve it |
---|
| 78 | * fully before creating the exception.</p> |
---|
| 79 | * |
---|
| 80 | * @param message The error or warning message. |
---|
| 81 | * @param publicId The public identifer of the entity that generated |
---|
| 82 | * the error or warning. |
---|
| 83 | * @param systemId The system identifer of the entity that generated |
---|
| 84 | * the error or warning. |
---|
| 85 | * @param lineNumber The line number of the end of the text that |
---|
| 86 | * caused the error or warning. |
---|
| 87 | * @param columnNumber The column number of the end of the text that |
---|
| 88 | * caused the error or warning. |
---|
| 89 | * @param manager Pointer to the memory manager to be used to |
---|
| 90 | * allocate objects. |
---|
| 91 | * @see Parser#setLocale |
---|
| 92 | */ |
---|
| 93 | SAXParseException |
---|
| 94 | ( |
---|
| 95 | const XMLCh* const message |
---|
| 96 | , const XMLCh* const publicId |
---|
| 97 | , const XMLCh* const systemId |
---|
| 98 | , const XMLSSize_t lineNumber |
---|
| 99 | , const XMLSSize_t columnNumber |
---|
| 100 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 101 | ); |
---|
| 102 | |
---|
| 103 | /** |
---|
| 104 | * Copy constructor |
---|
| 105 | * |
---|
| 106 | * @param toCopy The object to be copied |
---|
| 107 | */ |
---|
| 108 | SAXParseException(const SAXParseException& toCopy); |
---|
| 109 | |
---|
| 110 | /** |
---|
| 111 | * Destructor |
---|
| 112 | */ |
---|
| 113 | ~SAXParseException(); |
---|
| 114 | |
---|
| 115 | //@} |
---|
| 116 | |
---|
| 117 | /** @name Assignment operator */ |
---|
| 118 | //@{ |
---|
| 119 | /** |
---|
| 120 | * Assignment operator |
---|
| 121 | * |
---|
| 122 | * @param toAssign The object to be copied through assignment |
---|
| 123 | * |
---|
| 124 | */ |
---|
| 125 | SAXParseException& operator=(const SAXParseException& toAssign); |
---|
| 126 | //@} |
---|
| 127 | |
---|
| 128 | /** @name Getter methods */ |
---|
| 129 | //@{ |
---|
| 130 | /** |
---|
| 131 | * The column number of the end of the text where the exception occurred. |
---|
| 132 | * |
---|
| 133 | * <p>The first column in a line is position 1.</p> |
---|
| 134 | * |
---|
| 135 | * @return An integer representing the column number, or -1 |
---|
| 136 | * if none is available. |
---|
| 137 | * @see Locator#getColumnNumber |
---|
| 138 | */ |
---|
| 139 | XMLSSize_t getColumnNumber() const; |
---|
| 140 | /** |
---|
| 141 | * The line number of the end of the text where the exception occurred. |
---|
| 142 | * |
---|
| 143 | * @return An integer representing the line number, or -1 |
---|
| 144 | * if none is available. |
---|
| 145 | * @see Locator#getLineNumber |
---|
| 146 | */ |
---|
| 147 | XMLSSize_t getLineNumber() const; |
---|
| 148 | /** |
---|
| 149 | * Get the public identifier of the entity where the exception occurred. |
---|
| 150 | * |
---|
| 151 | * @return A string containing the public identifier, or null |
---|
| 152 | * if none is available. |
---|
| 153 | * @see Locator#getPublicId |
---|
| 154 | */ |
---|
| 155 | const XMLCh* getPublicId() const; |
---|
| 156 | /** |
---|
| 157 | * Get the system identifier of the entity where the exception occurred. |
---|
| 158 | * |
---|
| 159 | * <p>If the system identifier is a URL, it will be resolved |
---|
| 160 | * fully.</p> |
---|
| 161 | * |
---|
| 162 | * @return A string containing the system identifier, or null |
---|
| 163 | * if none is available. |
---|
| 164 | * @see Locator#getSystemId |
---|
| 165 | */ |
---|
| 166 | const XMLCh* getSystemId() const; |
---|
| 167 | //@} |
---|
| 168 | |
---|
| 169 | private: |
---|
| 170 | /* Data Members */ |
---|
| 171 | |
---|
| 172 | /* The column in the source text where the error occured. */ |
---|
| 173 | XMLSSize_t fColumnNumber; |
---|
| 174 | /* The line in the source text where the error occured. */ |
---|
| 175 | XMLSSize_t fLineNumber; |
---|
| 176 | /* The public id of the file where the error occured. */ |
---|
| 177 | XMLCh* fPublicId; |
---|
| 178 | /* The system id of the file where the error occured. */ |
---|
| 179 | XMLCh* fSystemId; |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | }; |
---|
| 183 | |
---|
| 184 | XERCES_CPP_NAMESPACE_END |
---|
| 185 | |
---|
| 186 | #endif |
---|