XML technologies / XML / XML in a Nutshell / DOM reference / Object reference / DOMException
(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)
Structured exceptions elegantly separate normal program flow from handling unusual or unexpected events. Some languages, such as ECMAScript and Perl, have no exceptions. They use error codes instead, returned to the program by the method detecting the error.
The ExceptionCode is an integer distinguishing exception types. The following ExceptionCodes are currently defined; unused codes are reserved by the W3C for future use.
INDEX_SIZE_ERR [unsigned short, value: 1]
An invalid index was passed to a method. Valid indices generally satisfy 0 <= index < collection.length.
Java binding
public static final short INDEX_SIZE_ERR = 1;
DOMSTRING_SIZE_ERR [unsigned short, value: 2]
The DOMString to be generated by the method is too large.
Java binding
public static final short DOMSTRING_SIZE_ERR = 2;
HIERARCHY_REQUEST_ERR [unsigned short, value: 3]
Inserting the requested node would violate document structure, for example by making a node its own child.
Java binding
public static final short HIERARCHY_REQUEST_ERR = 3;
WRONG_DOCUMENT_ERR [unsigned short, value: 4]
An attempt was made to insert a node from another document directly into this one.
Java binding
public static final short WRONG_DOCUMENT_ERR = 4;
INVALID_CHARACTER_ERR [unsigned short, value: 5]
A name contains an invalid character. Spaces, for example, are forbidden: "mein element" would be an invalid name.
Java binding
public static final short INVALID_CHARACTER_ERR = 5;
NO_DATA_ALLOWED_ERR [unsigned short, value: 6]
An attempt was made to insert text into a node that does not support it, such as an Element node.
Java binding
public static final short NO_DATA_ALLOWED_ERR = 6;
NO_MODIFICATION_ALLOWED_ERR [unsigned short, value: 7]
An attempt was made to modify a read-only node.
Java binding
public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
NOT_FOUND_ERR [unsigned short, value: 8]
An attempt was made to modify a node that could not be found in this context.
Java binding
public static final short NOT_FOUND_ERR = 8;
NOT_SUPPORTED_ERR [unsigned short, value: 9]
If the current DOM implementation lacks an optional feature, this exception is raised.
Java binding
public static final short NOT_SUPPORTED_ERR = 9;
INUSE_ATTRIBUTE_ERR [unsigned short, value: 10]
An attribute already in use is reused, for example by passing the result of getAttributeNode() to another element’s setAttributeNode() method. Instead, first create a new Attr object using cloneNode().
Java binding
public static final short INUSE_ATTRIBUTE_ERR = 10;
INVALID_STATE_ERR [unsigned short, value: 11] (2)
An attempt was made to use an object that is no longer valid.
Java binding
public static final short INVALID_STATE_ERR = 11;
SYNTAX_ERR [unsigned short, value: 12] (2)
An invalid or illegal string was passed.
Java binding
public static final short SYNTAX_ERR = 12;
INVALID_MODIFICATION_ERR [unsigned short, value: 13] (2)
An attempt was made to change the underlying object type.
Java binding
public static final short INVALID_MODIFICATION_ERR = 13;
NAMESPACE_ERR [unsigned short, value: 14] (2)
A method supporting XML namespaces was used in a way violating namespace rules, such as using a name with a prefix, without specifying a corresponding namespace URI.
Java binding
public static final short NAMESPACE_ERR = 14;
INVALID_ACCESS_ERR [unsigned short, value: 15] (2)
The specific type does not support a parameter or action.
Java binding
public static final short INVALID_ACCESS_ERR = 15;
VALIDATION_ERR [unsigned short, value: 16] (3)
The attempted tree modification would cause a validity error.
Java binding
public static final short VALIDITY_ERR = 16;
TYPE_MISMATCH_ERR [unsigned short, value: 17] (3)
Raised if a parameter’s type is incompatible with the expected type.
Java binding
public static final short TYPE_MISMATCH_ERR = 17;
Copyright © 2005 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "XML in a Nutshell" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de