diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2000-12-13 14:21:07 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2000-12-13 14:21:07 (GMT) |
commit | 64acf1db222a5045f1b3b467ab801e85f9f8955a (patch) | |
tree | 9c2cd5a53a237210a45f8c612af5b40177b2f2df /Lib | |
parent | 2df6694eff50a90afb44a99adac37310a5d74408 (diff) | |
download | cpython-64acf1db222a5045f1b3b467ab801e85f9f8955a.zip cpython-64acf1db222a5045f1b3b467ab801e85f9f8955a.tar.gz cpython-64acf1db222a5045f1b3b467ab801e85f9f8955a.tar.bz2 |
Add standard DOM exception hierarchy.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/xml/dom/__init__.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Lib/xml/dom/__init__.py b/Lib/xml/dom/__init__.py index 0c9049e..abef398 100644 --- a/Lib/xml/dom/__init__.py +++ b/Lib/xml/dom/__init__.py @@ -37,3 +37,71 @@ class Node: DOCUMENT_TYPE_NODE = 10 DOCUMENT_FRAGMENT_NODE = 11 NOTATION_NODE = 12 + +#ExceptionCode +INDEX_SIZE_ERR = 1 +DOMSTRING_SIZE_ERR = 2 +HIERARCHY_REQUEST_ERR = 3 +WRONG_DOCUMENT_ERR = 4 +INVALID_CHARACTER_ERR = 5 +NO_DATA_ALLOWED_ERR = 6 +NO_MODIFICATION_ALLOWED_ERR = 7 +NOT_FOUND_ERR = 8 +NOT_SUPPORTED_ERR = 9 +INUSE_ATTRIBUTE_ERR = 10 +INVALID_STATE_ERR = 11 +SYNTAX_ERR = 12 +INVALID_MODIFICATION_ERR = 13 +NAMESPACE_ERR = 14 +INVALID_ACCESS_ERR = 15 + +class DOMException(Exception): + """Abstract base class for DOM exceptions. + Exceptions with specific codes are specializations of this class.""" + + pass + +class IndexSizeErr(DOMException): + code = INDEX_SIZE_ERR + +class DomstringSizeErr(DOMException): + code = DOMSTRING_SIZE_ERR + +class HierarchyRequestErr(DOMException): + code = HIERARCHY_REQUEST_ERR + +class WrongDocumentErr(DOMException): + code = WRONG_DOCUMENT_ERR + +class InvalidCharacterErr(DOMException): + code = INVALID_CHARACTER_ERR + +class NoDataAllowedErr(DOMException): + code = NO_DATA_ALLOWED_ERR + +class NoModificationAllowedErr(DOMException): + code = NO_MODIFICATION_ALLOWED_ERR + +class NotFoundErr(DOMException): + code = NOT_FOUND_ERR + +class NotSupportedErr(DOMException): + code = NOT_SUPPORTED_ERR + +class InuseAttributeErr(DOMException): + code = INUSE_ATTRIBUTE_ERR + +class InvalidStateErr(DOMException): + code = INVALID_STATE_ERR + +class SyntaxErr(DOMException): + code = SYNTAX_ERR + +class InvalidModificationErr(DOMException): + code = INVALID_MODIFICATION_ERR + +class NamespaceErr(DOMException): + code = NAMESPACE_ERR + +class InvalidAccessErr(DOMException): + code = INVALID_ACCESS_ERR |