[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Log: SAXParseException.hpp,v $
|
---|
| 59 | * Revision 1.6 2003/12/01 23:23:26 neilg
|
---|
| 60 | * fix for bug 25118; thanks to Jeroen Witmond
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.5 2003/08/13 15:43:24 knoaman
|
---|
| 63 | * Use memory manager when creating SAX exceptions.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.4 2003/05/15 18:27:05 knoaman
|
---|
| 66 | * Partial implementation of the configurable memory manager.
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.3 2002/11/04 14:56:26 tng
|
---|
| 69 | * C++ Namespace Support.
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.2 2002/05/27 18:33:07 tng
|
---|
| 72 | * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.1.1.1 2002/02/01 22:22:08 peiyongz
|
---|
| 75 | * sane_include
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.5 2000/02/24 20:12:55 abagchi
|
---|
| 78 | * Swat for removing Log from API docs
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.4 2000/02/12 01:27:19 aruna1
|
---|
| 81 | * Documentation updated
|
---|
| 82 | *
|
---|
| 83 | * Revision 1.3 2000/02/09 19:24:49 abagchi
|
---|
| 84 | * Inserted documentation for constructors and destructors
|
---|
| 85 | *
|
---|
| 86 | * Revision 1.2 2000/02/06 07:47:58 rahulj
|
---|
| 87 | * Year 2K copyright swat.
|
---|
| 88 | *
|
---|
| 89 | * Revision 1.1.1.1 1999/11/09 01:07:47 twl
|
---|
| 90 | * Initial checkin
|
---|
| 91 | *
|
---|
| 92 | * Revision 1.2 1999/11/08 20:45:02 rahul
|
---|
| 93 | * Swat for adding in Product name and CVS comment log variable.
|
---|
| 94 | *
|
---|
| 95 | */
|
---|
| 96 |
|
---|
| 97 |
|
---|
| 98 | #ifndef SAXPARSEEXCEPTION_HPP
|
---|
| 99 | #define SAXPARSEEXCEPTION_HPP
|
---|
| 100 |
|
---|
| 101 | #include <xercesc/sax/SAXException.hpp>
|
---|
| 102 |
|
---|
| 103 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 104 |
|
---|
| 105 | class Locator;
|
---|
| 106 |
|
---|
| 107 | /**
|
---|
| 108 | * Encapsulate an XML parse error or warning.
|
---|
| 109 | *
|
---|
| 110 | * <p>This exception will include information for locating the error
|
---|
| 111 | * in the original XML document. Note that although the application
|
---|
| 112 | * will receive a SAXParseException as the argument to the handlers
|
---|
| 113 | * in the ErrorHandler interface, the application is not actually
|
---|
| 114 | * required to throw the exception; instead, it can simply read the
|
---|
| 115 | * information in it and take a different action.</p>
|
---|
| 116 | *
|
---|
| 117 | * <p>Since this exception is a subclass of SAXException, it
|
---|
| 118 | * inherits the ability to wrap another exception.</p>
|
---|
| 119 | *
|
---|
| 120 | * @see SAXException#SAXException
|
---|
| 121 | * @see Locator#Locator
|
---|
| 122 | * @see ErrorHandler#ErrorHandler
|
---|
| 123 | */
|
---|
| 124 | class SAX_EXPORT SAXParseException : public SAXException
|
---|
| 125 | {
|
---|
| 126 | public:
|
---|
| 127 | /** @name Constructors and Destructor */
|
---|
| 128 | //@{
|
---|
| 129 | /**
|
---|
| 130 | * Create a new SAXParseException from a message and a Locator.
|
---|
| 131 | *
|
---|
| 132 | * <p>This constructor is especially useful when an application is
|
---|
| 133 | * creating its own exception from within a DocumentHandler
|
---|
| 134 | * callback.</p>
|
---|
| 135 | *
|
---|
| 136 | * @param message The error or warning message.
|
---|
| 137 | * @param locator The locator object for the error or warning.
|
---|
| 138 | * @param manager Pointer to the memory manager to be used to
|
---|
| 139 | * allocate objects.
|
---|
| 140 | * @see Locator#Locator
|
---|
| 141 | * @see Parser#setLocale
|
---|
| 142 | */
|
---|
| 143 | SAXParseException(const XMLCh* const message, const Locator& locator,
|
---|
| 144 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 145 |
|
---|
| 146 |
|
---|
| 147 | /**
|
---|
| 148 | * Create a new SAXParseException.
|
---|
| 149 | *
|
---|
| 150 | * <p>This constructor is most useful for parser writers.</p>
|
---|
| 151 | *
|
---|
| 152 | * <p>If the system identifier is a URL, the parser must resolve it
|
---|
| 153 | * fully before creating the exception.</p>
|
---|
| 154 | *
|
---|
| 155 | * @param message The error or warning message.
|
---|
| 156 | * @param publicId The public identifer of the entity that generated
|
---|
| 157 | * the error or warning.
|
---|
| 158 | * @param systemId The system identifer of the entity that generated
|
---|
| 159 | * the error or warning.
|
---|
| 160 | * @param lineNumber The line number of the end of the text that
|
---|
| 161 | * caused the error or warning.
|
---|
| 162 | * @param columnNumber The column number of the end of the text that
|
---|
| 163 | * caused the error or warning.
|
---|
| 164 | * @param manager Pointer to the memory manager to be used to
|
---|
| 165 | * allocate objects.
|
---|
| 166 | * @see Parser#setLocale
|
---|
| 167 | */
|
---|
| 168 | SAXParseException
|
---|
| 169 | (
|
---|
| 170 | const XMLCh* const message
|
---|
| 171 | , const XMLCh* const publicId
|
---|
| 172 | , const XMLCh* const systemId
|
---|
| 173 | , const XMLSSize_t lineNumber
|
---|
| 174 | , const XMLSSize_t columnNumber
|
---|
| 175 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 176 | );
|
---|
| 177 |
|
---|
| 178 | /**
|
---|
| 179 | * Copy constructor
|
---|
| 180 | *
|
---|
| 181 | * @param toCopy The object to be copied
|
---|
| 182 | */
|
---|
| 183 | SAXParseException(const SAXParseException& toCopy);
|
---|
| 184 |
|
---|
| 185 | /**
|
---|
| 186 | * Destructor
|
---|
| 187 | */
|
---|
| 188 | ~SAXParseException();
|
---|
| 189 |
|
---|
| 190 | //@}
|
---|
| 191 |
|
---|
| 192 | /** @name Assignment operator */
|
---|
| 193 | //@{
|
---|
| 194 | /**
|
---|
| 195 | * Assignment operator
|
---|
| 196 | *
|
---|
| 197 | * @param toAssign The object to be copied through assignment
|
---|
| 198 | *
|
---|
| 199 | */
|
---|
| 200 | SAXParseException& operator=(const SAXParseException& toAssign);
|
---|
| 201 | //@}
|
---|
| 202 |
|
---|
| 203 | /** @name Getter methods */
|
---|
| 204 | //@{
|
---|
| 205 | /**
|
---|
| 206 | * The column number of the end of the text where the exception occurred.
|
---|
| 207 | *
|
---|
| 208 | * <p>The first column in a line is position 1.</p>
|
---|
| 209 | *
|
---|
| 210 | * @return An integer representing the column number, or -1
|
---|
| 211 | * if none is available.
|
---|
| 212 | * @see Locator#getColumnNumber
|
---|
| 213 | */
|
---|
| 214 | XMLSSize_t getColumnNumber() const;
|
---|
| 215 | /**
|
---|
| 216 | * The line number of the end of the text where the exception occurred.
|
---|
| 217 | *
|
---|
| 218 | * @return An integer representing the line number, or -1
|
---|
| 219 | * if none is available.
|
---|
| 220 | * @see Locator#getLineNumber
|
---|
| 221 | */
|
---|
| 222 | XMLSSize_t getLineNumber() const;
|
---|
| 223 | /**
|
---|
| 224 | * Get the public identifier of the entity where the exception occurred.
|
---|
| 225 | *
|
---|
| 226 | * @return A string containing the public identifier, or null
|
---|
| 227 | * if none is available.
|
---|
| 228 | * @see Locator#getPublicId
|
---|
| 229 | */
|
---|
| 230 | const XMLCh* getPublicId() const;
|
---|
| 231 | /**
|
---|
| 232 | * Get the system identifier of the entity where the exception occurred.
|
---|
| 233 | *
|
---|
| 234 | * <p>If the system identifier is a URL, it will be resolved
|
---|
| 235 | * fully.</p>
|
---|
| 236 | *
|
---|
| 237 | * @return A string containing the system identifier, or null
|
---|
| 238 | * if none is available.
|
---|
| 239 | * @see Locator#getSystemId
|
---|
| 240 | */
|
---|
| 241 | const XMLCh* getSystemId() const;
|
---|
| 242 | //@}
|
---|
| 243 |
|
---|
| 244 | private:
|
---|
| 245 | /* Data Members */
|
---|
| 246 |
|
---|
| 247 | /* The column in the source text where the error occured. */
|
---|
| 248 | XMLSSize_t fColumnNumber;
|
---|
| 249 | /* The line in the source text where the error occured. */
|
---|
| 250 | XMLSSize_t fLineNumber;
|
---|
| 251 | /* The public id of the file where the error occured. */
|
---|
| 252 | XMLCh* fPublicId;
|
---|
| 253 | /* The system id of the file where the error occured. */
|
---|
| 254 | XMLCh* fSystemId;
|
---|
| 255 |
|
---|
| 256 |
|
---|
| 257 | };
|
---|
| 258 |
|
---|
| 259 | XERCES_CPP_NAMESPACE_END
|
---|
| 260 |
|
---|
| 261 | #endif
|
---|