[188] | 1 | #ifndef DOMException_HEADER_GUARD_
|
---|
| 2 | #define DOMException_HEADER_GUARD_
|
---|
| 3 |
|
---|
| 4 | /*
|
---|
| 5 | * The Apache Software License, Version 1.1
|
---|
| 6 | *
|
---|
| 7 | * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
|
---|
| 8 | * reserved.
|
---|
| 9 | *
|
---|
| 10 | * Redistribution and use in source and binary forms, with or without
|
---|
| 11 | * modification, are permitted provided that the following conditions
|
---|
| 12 | * are met:
|
---|
| 13 | *
|
---|
| 14 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer.
|
---|
| 16 | *
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 18 | * notice, this list of conditions and the following disclaimer in
|
---|
| 19 | * the documentation and/or other materials provided with the
|
---|
| 20 | * distribution.
|
---|
| 21 | *
|
---|
| 22 | * 3. The end-user documentation included with the redistribution,
|
---|
| 23 | * if any, must include the following acknowledgment:
|
---|
| 24 | * "This product includes software developed by the
|
---|
| 25 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 26 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 27 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 28 | *
|
---|
| 29 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 30 | * not be used to endorse or promote products derived from this
|
---|
| 31 | * software without prior written permission. For written
|
---|
| 32 | * permission, please contact apache\@apache.org.
|
---|
| 33 | *
|
---|
| 34 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 35 | * nor may "Apache" appear in their name, without prior written
|
---|
| 36 | * permission of the Apache Software Foundation.
|
---|
| 37 | *
|
---|
| 38 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 39 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 40 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 41 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 42 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 43 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 44 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 45 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 46 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 48 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 49 | * SUCH DAMAGE.
|
---|
| 50 | * ====================================================================
|
---|
| 51 | *
|
---|
| 52 | * This software consists of voluntary contributions made by many
|
---|
| 53 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 54 | * originally based on software copyright (c) 2001, International
|
---|
| 55 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 56 | * on the Apache Software Foundation, please see
|
---|
| 57 | * <http://www.apache.org/>.
|
---|
| 58 | */
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | * $Id: DOMException.hpp,v 1.6 2004/01/29 11:44:26 cargilld Exp $
|
---|
| 62 | */
|
---|
| 63 |
|
---|
| 64 | #include <xercesc/util/XercesDefs.hpp>
|
---|
| 65 |
|
---|
| 66 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | /**
|
---|
| 70 | * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
|
---|
| 71 | * when an operation is impossible to perform (either for logical reasons,
|
---|
| 72 | * because data is lost, or because the implementation has become unstable).
|
---|
| 73 | * In general, DOM methods return specific error values in ordinary
|
---|
| 74 | * processing situations, such as out-of-bound errors when using
|
---|
| 75 | * <code>DOMNodeList</code>.
|
---|
| 76 | * <p>Implementations should raise other exceptions under other circumstances.
|
---|
| 77 | * For example, implementations should raise an implementation-dependent
|
---|
| 78 | * exception if a <code>null</code> argument is passed.
|
---|
| 79 | * <p>Some languages and object systems do not support the concept of
|
---|
| 80 | * exceptions. For such systems, error conditions may be indicated using
|
---|
| 81 | * native error reporting mechanisms. For some bindings, for example,
|
---|
| 82 | * methods may return error codes similar to those listed in the
|
---|
| 83 | * corresponding method descriptions.
|
---|
| 84 | * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
|
---|
| 85 | * @since DOM Level 1
|
---|
| 86 | */
|
---|
| 87 |
|
---|
| 88 | class CDOM_EXPORT DOMException {
|
---|
| 89 | public:
|
---|
| 90 | // -----------------------------------------------------------------------
|
---|
| 91 | // Constructors
|
---|
| 92 | // -----------------------------------------------------------------------
|
---|
| 93 | /** @name Constructors */
|
---|
| 94 | //@{
|
---|
| 95 | /**
|
---|
| 96 | * Default constructor for DOMException.
|
---|
| 97 | *
|
---|
| 98 | */
|
---|
| 99 | DOMException();
|
---|
| 100 |
|
---|
| 101 | /**
|
---|
| 102 | * Constructor which takes an error code and a message.
|
---|
| 103 | *
|
---|
| 104 | * @param code The error code which indicates the exception
|
---|
| 105 | * @param message The string containing the error message
|
---|
| 106 | */
|
---|
| 107 | DOMException(short code, const XMLCh *message);
|
---|
| 108 |
|
---|
| 109 | /**
|
---|
| 110 | * Copy constructor.
|
---|
| 111 | *
|
---|
| 112 | * @param other The object to be copied.
|
---|
| 113 | */
|
---|
| 114 | DOMException(const DOMException &other);
|
---|
| 115 |
|
---|
| 116 | //@}
|
---|
| 117 |
|
---|
| 118 | // -----------------------------------------------------------------------
|
---|
| 119 | // Destructors
|
---|
| 120 | // -----------------------------------------------------------------------
|
---|
| 121 | /** @name Destructor. */
|
---|
| 122 | //@{
|
---|
| 123 | /**
|
---|
| 124 | * Destructor for DOMException.
|
---|
| 125 | *
|
---|
| 126 | */
|
---|
| 127 | virtual ~DOMException();
|
---|
| 128 | //@}
|
---|
| 129 |
|
---|
| 130 | public:
|
---|
| 131 | // -----------------------------------------------------------------------
|
---|
| 132 | // Class Types
|
---|
| 133 | // -----------------------------------------------------------------------
|
---|
| 134 | /** @name Public Contants */
|
---|
| 135 | //@{
|
---|
| 136 | /**
|
---|
| 137 | * ExceptionCode
|
---|
| 138 | *
|
---|
| 139 | * <p><code>INDEX_SIZE_ERR:</code>
|
---|
| 140 | * If index or size is negative, or greater than the allowed value.</p>
|
---|
| 141 | *
|
---|
| 142 | * <p><code>DOMSTRING_SIZE_ERR:</code>
|
---|
| 143 | * If the specified range of text does not fit into a DOMString.</p>
|
---|
| 144 | *
|
---|
| 145 | * <p><code>HIERARCHY_REQUEST_ERR:</code>
|
---|
| 146 | * If any node is inserted somewhere it doesn't belong.</p>
|
---|
| 147 | *
|
---|
| 148 | * <p><code>WRONG_DOCUMENT_ERR:</code>
|
---|
| 149 | * If a node is used in a different document than the one that created it
|
---|
| 150 | * (that doesn't support it).</p>
|
---|
| 151 | *
|
---|
| 152 | * <p><code>INVALID_CHARACTER_ERR:</code>
|
---|
| 153 | * If an invalid or illegal character is specified, such as in a name. See
|
---|
| 154 | * production 2 in the XML specification for the definition of a legal
|
---|
| 155 | * character, and production 5 for the definition of a legal name
|
---|
| 156 | * character.</p>
|
---|
| 157 | *
|
---|
| 158 | * <p><code>NO_DATA_ALLOWED_ERR:</code>
|
---|
| 159 | * If data is specified for a node which does not support data.</p>
|
---|
| 160 | *
|
---|
| 161 | * <p><code>NO_MODIFICATION_ALLOWED_ERR:</code>
|
---|
| 162 | * If an attempt is made to modify an object where modifications are not
|
---|
| 163 | * allowed.</p>
|
---|
| 164 | *
|
---|
| 165 | * <p><code>NOT_FOUND_ERR:</code>
|
---|
| 166 | * If an attempt is made to reference a node in a context where it does
|
---|
| 167 | * not exist.</p>
|
---|
| 168 | *
|
---|
| 169 | * <p><code>NOT_SUPPORTED_ERR:</code>
|
---|
| 170 | * If the implementation does not support the requested type of object or
|
---|
| 171 | * operation.</p>
|
---|
| 172 | *
|
---|
| 173 | * <p><code>INUSE_ATTRIBUTE_ERR:</code>
|
---|
| 174 | * If an attempt is made to add an attribute that is already in use
|
---|
| 175 | * elsewhere.</p>
|
---|
| 176 | *
|
---|
| 177 | * The above are since DOM Level 1
|
---|
| 178 | * @since DOM Level 1
|
---|
| 179 | *
|
---|
| 180 | * <p><code>INVALID_STATE_ERR:</code>
|
---|
| 181 | * If an attempt is made to use an object that is not, or is no longer,
|
---|
| 182 | * usable.</p>
|
---|
| 183 | *
|
---|
| 184 | * <p><code>SYNTAX_ERR:</code>
|
---|
| 185 | * If an invalid or illegal string is specified.</p>
|
---|
| 186 | *
|
---|
| 187 | * <p><code>INVALID_MODIFICATION_ERR:</code>
|
---|
| 188 | * If an attempt is made to modify the type of the underlying object.</p>
|
---|
| 189 | *
|
---|
| 190 | * <p><code>NAMESPACE_ERR:</code>
|
---|
| 191 | * If an attempt is made to create or change an object in a way which is
|
---|
| 192 | * incorrect with regard to namespaces.</p>
|
---|
| 193 | *
|
---|
| 194 | * <p><code>INVALID_ACCESS_ERR:</code>
|
---|
| 195 | * If a parameter or an operation is not supported by the underlying
|
---|
| 196 | * object.
|
---|
| 197 | *
|
---|
| 198 | * The above are since DOM Level 2
|
---|
| 199 | * @since DOM Level 2
|
---|
| 200 | *
|
---|
| 201 | * <p><code>VALIDATION_ERR:</code>
|
---|
| 202 | * If a call to a method such as <code>insertBefore</code> or
|
---|
| 203 | * <code>removeChild</code> would make the <code>Node</code> invalid
|
---|
| 204 | * with respect to "partial validity", this exception would be raised
|
---|
| 205 | * and the operation would not be done.
|
---|
| 206 | *
|
---|
| 207 | * The above is since DOM Level 2
|
---|
| 208 | * @since DOM Level 3
|
---|
| 209 | */
|
---|
| 210 | enum ExceptionCode {
|
---|
| 211 | INDEX_SIZE_ERR = 1,
|
---|
| 212 | DOMSTRING_SIZE_ERR = 2,
|
---|
| 213 | HIERARCHY_REQUEST_ERR = 3,
|
---|
| 214 | WRONG_DOCUMENT_ERR = 4,
|
---|
| 215 | INVALID_CHARACTER_ERR = 5,
|
---|
| 216 | NO_DATA_ALLOWED_ERR = 6,
|
---|
| 217 | NO_MODIFICATION_ALLOWED_ERR = 7,
|
---|
| 218 | NOT_FOUND_ERR = 8,
|
---|
| 219 | NOT_SUPPORTED_ERR = 9,
|
---|
| 220 | INUSE_ATTRIBUTE_ERR = 10,
|
---|
| 221 | INVALID_STATE_ERR = 11,
|
---|
| 222 | SYNTAX_ERR = 12,
|
---|
| 223 | INVALID_MODIFICATION_ERR = 13,
|
---|
| 224 | NAMESPACE_ERR = 14,
|
---|
| 225 | INVALID_ACCESS_ERR = 15,
|
---|
| 226 | VALIDATION_ERR = 16
|
---|
| 227 | };
|
---|
| 228 | //@}
|
---|
| 229 |
|
---|
| 230 | // -----------------------------------------------------------------------
|
---|
| 231 | // Class Types
|
---|
| 232 | // -----------------------------------------------------------------------
|
---|
| 233 | /** @name Public variables */
|
---|
| 234 | //@{
|
---|
| 235 | /**
|
---|
| 236 | * A code value, from the set defined by the ExceptionCode enum,
|
---|
| 237 | * indicating the type of error that occured.
|
---|
| 238 | */
|
---|
| 239 | ExceptionCode code;
|
---|
| 240 |
|
---|
| 241 | /**
|
---|
| 242 | * A string value. Applications may use this field to hold an error
|
---|
| 243 | * message. The field value is not set by the DOM implementation,
|
---|
| 244 | * meaning that the string will be empty when an exception is first
|
---|
| 245 | * thrown.
|
---|
| 246 | */
|
---|
| 247 | const XMLCh *msg;
|
---|
| 248 | //@}
|
---|
| 249 |
|
---|
| 250 | private:
|
---|
| 251 | // -----------------------------------------------------------------------
|
---|
| 252 | // Unimplemented constructors and operators
|
---|
| 253 | // -----------------------------------------------------------------------
|
---|
| 254 | DOMException & operator = (const DOMException &);
|
---|
| 255 | };
|
---|
| 256 |
|
---|
| 257 | XERCES_CPP_NAMESPACE_END
|
---|
| 258 |
|
---|
| 259 | #endif
|
---|
| 260 |
|
---|