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
013package 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 */
032public class DOMException extends RuntimeException {
033    public DOMException(short code, String message) {
034       super(message);
035       this.code = code;
036    }
037    public short   code;
038    // ExceptionCode
039    /**
040     * If index or size is negative, or greater than the allowed value
041     */
042    public static final short INDEX_SIZE_ERR            = 1;
043    /**
044     * If the specified range of text does not fit into a DOMString
045     */
046    public static final short DOMSTRING_SIZE_ERR        = 2;
047    /**
048     * If any node is inserted somewhere it doesn't belong
049     */
050    public static final short HIERARCHY_REQUEST_ERR     = 3;
051    /**
052     * If a node is used in a different document than the one that created it 
053     * (that doesn't support it)
054     */
055    public static final short WRONG_DOCUMENT_ERR        = 4;
056    /**
057     * If an invalid or illegal character is specified, such as in a name. See 
058     * production 2 in the XML specification for the definition of a legal 
059     * character, and production 5 for the definition of a legal name 
060     * character.
061     */
062    public static final short INVALID_CHARACTER_ERR     = 5;
063    /**
064     * If data is specified for a node which does not support data
065     */
066    public static final short NO_DATA_ALLOWED_ERR       = 6;
067    /**
068     * If an attempt is made to modify an object where modifications are not 
069     * allowed
070     */
071    public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
072    /**
073     * If an attempt is made to reference a node in a context where it does 
074     * not exist
075     */
076    public static final short NOT_FOUND_ERR             = 8;
077    /**
078     * If the implementation does not support the requested type of object or 
079     * operation.
080     */
081    public static final short NOT_SUPPORTED_ERR         = 9;
082    /**
083     * If an attempt is made to add an attribute that is already in use 
084     * elsewhere
085     */
086    public static final short INUSE_ATTRIBUTE_ERR       = 10;
087    /**
088     * If an attempt is made to use an object that is not, or is no longer, 
089     * usable.
090     * @since DOM Level 2
091     */
092    public static final short INVALID_STATE_ERR         = 11;
093    /**
094     * If an invalid or illegal string is specified.
095     * @since DOM Level 2
096     */
097    public static final short SYNTAX_ERR                = 12;
098    /**
099     * 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}