GNU Classpath (0.95) | |
Frames | No Frames |
1: /* 2: * Copyright (c) 2004 World Wide Web Consortium, 3: * 4: * (Massachusetts Institute of Technology, European Research Consortium for 5: * Informatics and Mathematics, Keio University). All Rights Reserved. This 6: * work is distributed under the W3C(r) Software License [1] in the hope that 7: * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 8: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9: * 10: * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 11: */ 12: 13: package org.w3c.dom; 14: 15: /** 16: * DOM operations only raise exceptions in "exceptional" circumstances, i.e., 17: * when an operation is impossible to perform (either for logical reasons, 18: * because data is lost, or because the implementation has become unstable). 19: * In general, DOM methods return specific error values in ordinary 20: * processing situations, such as out-of-bound errors when using 21: * <code>NodeList</code>. 22: * <p>Implementations should raise other exceptions under other circumstances. 23: * For example, implementations should raise an implementation-dependent 24: * exception if a <code>null</code> argument is passed when <code>null</code> 25: * was not expected. 26: * <p>Some languages and object systems do not support the concept of 27: * exceptions. For such systems, error conditions may be indicated using 28: * native error reporting mechanisms. For some bindings, for example, 29: * methods may return error codes similar to those listed in the 30: * corresponding method descriptions. 31: * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>. 32: */ 33: public class DOMException extends RuntimeException { 34: public DOMException(short code, String message) { 35: super(message); 36: this.code = code; 37: } 38: public short code; 39: // ExceptionCode 40: /** 41: * If index or size is negative, or greater than the allowed value. 42: */ 43: public static final short INDEX_SIZE_ERR = 1; 44: /** 45: * If the specified range of text does not fit into a 46: * <code>DOMString</code>. 47: */ 48: public static final short DOMSTRING_SIZE_ERR = 2; 49: /** 50: * If any <code>Node</code> is inserted somewhere it doesn't belong. 51: */ 52: public static final short HIERARCHY_REQUEST_ERR = 3; 53: /** 54: * If a <code>Node</code> is used in a different document than the one 55: * that created it (that doesn't support it). 56: */ 57: public static final short WRONG_DOCUMENT_ERR = 4; 58: /** 59: * If an invalid or illegal character is specified, such as in an XML name. 60: */ 61: public static final short INVALID_CHARACTER_ERR = 5; 62: /** 63: * If data is specified for a <code>Node</code> which does not support 64: * data. 65: */ 66: public static final short NO_DATA_ALLOWED_ERR = 6; 67: /** 68: * If an attempt is made to modify an object where modifications are not 69: * allowed. 70: */ 71: public static final short NO_MODIFICATION_ALLOWED_ERR = 7; 72: /** 73: * If an attempt is made to reference a <code>Node</code> in a context 74: * where it does not exist. 75: */ 76: public static final short NOT_FOUND_ERR = 8; 77: /** 78: * If the implementation does not support the requested type of object or 79: * operation. 80: */ 81: public static final short NOT_SUPPORTED_ERR = 9; 82: /** 83: * If an attempt is made to add an attribute that is already in use 84: * elsewhere. 85: */ 86: public static final short INUSE_ATTRIBUTE_ERR = 10; 87: /** 88: * If an attempt is made to use an object that is not, or is no longer, 89: * usable. 90: * @since DOM Level 2 91: */ 92: public static final short INVALID_STATE_ERR = 11; 93: /** 94: * If an invalid or illegal string is specified. 95: * @since DOM Level 2 96: */ 97: public static final short SYNTAX_ERR = 12; 98: /** 99: * If an attempt is made to modify the type of the underlying object. 100: * @since DOM Level 2 101: */ 102: public static final short INVALID_MODIFICATION_ERR = 13; 103: /** 104: * If an attempt is made to create or change an object in a way which is 105: * incorrect with regard to namespaces. 106: * @since DOM Level 2 107: */ 108: public static final short NAMESPACE_ERR = 14; 109: /** 110: * If a parameter or an operation is not supported by the underlying 111: * object. 112: * @since DOM Level 2 113: */ 114: public static final short INVALID_ACCESS_ERR = 15; 115: /** 116: * If a call to a method such as <code>insertBefore</code> or 117: * <code>removeChild</code> would make the <code>Node</code> invalid 118: * with respect to "partial validity", this exception would be raised 119: * and the operation would not be done. This code is used in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Val-20040127/'>DOM Level 3 Validation</a>] 120: * . Refer to this specification for further information. 121: * @since DOM Level 3 122: */ 123: public static final short VALIDATION_ERR = 16; 124: /** 125: * If the type of an object is incompatible with the expected type of the 126: * parameter associated to the object. 127: * @since DOM Level 3 128: */ 129: public static final short TYPE_MISMATCH_ERR = 17; 130: 131: }
GNU Classpath (0.95) |