001: /*
002: * Copyright (c) 2000 World Wide Web Consortium,
003: * (Massachusetts Institute of Technology, Institut National de
004: * Recherche en Informatique et en Automatique, Keio University). All
005: * Rights Reserved. This program is distributed under the W3C's Software
006: * Intellectual Property License. This program is distributed in the
007: * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008: * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009: * PURPOSE.
010: * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011: */
012:
013: package org.w3c.dom;
014:
015: /**
016: * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
017: * when an operation is impossible to perform (either for logical reasons,
018: * because data is lost, or because the implementation has become unstable).
019: * In general, DOM methods return specific error values in ordinary
020: * processing situations, such as out-of-bound errors when using
021: * <code>NodeList</code>.
022: * <p>Implementations should raise other exceptions under other circumstances.
023: * For example, implementations should raise an implementation-dependent
024: * exception if a <code>null</code> argument is passed.
025: * <p>Some languages and object systems do not support the concept of
026: * exceptions. For such systems, error conditions may be indicated using
027: * native error reporting mechanisms. For some bindings, for example,
028: * methods may return error codes similar to those listed in the
029: * corresponding method descriptions.
030: * <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>.
031: */
032: public class DOMException extends RuntimeException {
033: public DOMException(short code, String message) {
034: super (message);
035: this .code = code;
036: }
037:
038: public short code;
039: // ExceptionCode
040: /**
041: * If index or size is negative, or greater than the allowed value
042: */
043: public static final short INDEX_SIZE_ERR = 1;
044: /**
045: * If the specified range of text does not fit into a DOMString
046: */
047: public static final short DOMSTRING_SIZE_ERR = 2;
048: /**
049: * If any node is inserted somewhere it doesn't belong
050: */
051: public static final short HIERARCHY_REQUEST_ERR = 3;
052: /**
053: * If a node is used in a different document than the one that created it
054: * (that doesn't support it)
055: */
056: public static final short WRONG_DOCUMENT_ERR = 4;
057: /**
058: * If an invalid or illegal character is specified, such as in a name. See
059: * production 2 in the XML specification for the definition of a legal
060: * character, and production 5 for the definition of a legal name
061: * character.
062: */
063: public static final short INVALID_CHARACTER_ERR = 5;
064: /**
065: * If data is specified for a node which does not support data
066: */
067: public static final short NO_DATA_ALLOWED_ERR = 6;
068: /**
069: * If an attempt is made to modify an object where modifications are not
070: * allowed
071: */
072: public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
073: /**
074: * If an attempt is made to reference a node in a context where it does
075: * not exist
076: */
077: public static final short NOT_FOUND_ERR = 8;
078: /**
079: * If the implementation does not support the requested type of object or
080: * operation.
081: */
082: public static final short NOT_SUPPORTED_ERR = 9;
083: /**
084: * If an attempt is made to add an attribute that is already in use
085: * elsewhere
086: */
087: public static final short INUSE_ATTRIBUTE_ERR = 10;
088: /**
089: * If an attempt is made to use an object that is not, or is no longer,
090: * usable.
091: * @since DOM Level 2
092: */
093: public static final short INVALID_STATE_ERR = 11;
094: /**
095: * If an invalid or illegal string is specified.
096: * @since DOM Level 2
097: */
098: public static final short SYNTAX_ERR = 12;
099: /**
100: * If an attempt is made to modify the type of the underlying object.
101: * @since DOM Level 2
102: */
103: public static final short INVALID_MODIFICATION_ERR = 13;
104: /**
105: * If an attempt is made to create or change an object in a way which is
106: * incorrect with regard to namespaces.
107: * @since DOM Level 2
108: */
109: public static final short NAMESPACE_ERR = 14;
110: /**
111: * If a parameter or an operation is not supported by the underlying
112: * object.
113: * @since DOM Level 2
114: */
115: public static final short INVALID_ACCESS_ERR = 15;
116:
117: }
|