+++ /dev/null
-"""W3C Document Object Model implementation for Python.\r
-\r
-The Python mapping of the Document Object Model is documented in the\r
-Python Library Reference in the section on the xml.dom package.\r
-\r
-This package contains the following modules:\r
-\r
-minidom -- A simple implementation of the Level 1 DOM with namespace\r
- support added (based on the Level 2 specification) and other\r
- minor Level 2 functionality.\r
-\r
-pulldom -- DOM builder supporting on-demand tree-building for selected\r
- subtrees of the document.\r
-\r
-"""\r
-\r
-\r
-class Node:\r
- """Class giving the NodeType constants."""\r
-\r
- # DOM implementations may use this as a base class for their own\r
- # Node implementations. If they don't, the constants defined here\r
- # should still be used as the canonical definitions as they match\r
- # the values given in the W3C recommendation. Client code can\r
- # safely refer to these values in all tests of Node.nodeType\r
- # values.\r
-\r
- ELEMENT_NODE = 1\r
- ATTRIBUTE_NODE = 2\r
- TEXT_NODE = 3\r
- CDATA_SECTION_NODE = 4\r
- ENTITY_REFERENCE_NODE = 5\r
- ENTITY_NODE = 6\r
- PROCESSING_INSTRUCTION_NODE = 7\r
- COMMENT_NODE = 8\r
- DOCUMENT_NODE = 9\r
- DOCUMENT_TYPE_NODE = 10\r
- DOCUMENT_FRAGMENT_NODE = 11\r
- NOTATION_NODE = 12\r
-\r
-\r
-#ExceptionCode\r
-INDEX_SIZE_ERR = 1\r
-DOMSTRING_SIZE_ERR = 2\r
-HIERARCHY_REQUEST_ERR = 3\r
-WRONG_DOCUMENT_ERR = 4\r
-INVALID_CHARACTER_ERR = 5\r
-NO_DATA_ALLOWED_ERR = 6\r
-NO_MODIFICATION_ALLOWED_ERR = 7\r
-NOT_FOUND_ERR = 8\r
-NOT_SUPPORTED_ERR = 9\r
-INUSE_ATTRIBUTE_ERR = 10\r
-INVALID_STATE_ERR = 11\r
-SYNTAX_ERR = 12\r
-INVALID_MODIFICATION_ERR = 13\r
-NAMESPACE_ERR = 14\r
-INVALID_ACCESS_ERR = 15\r
-VALIDATION_ERR = 16\r
-\r
-\r
-class DOMException(Exception):\r
- """Abstract base class for DOM exceptions.\r
- Exceptions with specific codes are specializations of this class."""\r
-\r
- def __init__(self, *args, **kw):\r
- if self.__class__ is DOMException:\r
- raise RuntimeError(\r
- "DOMException should not be instantiated directly")\r
- Exception.__init__(self, *args, **kw)\r
-\r
- def _get_code(self):\r
- return self.code\r
-\r
-\r
-class IndexSizeErr(DOMException):\r
- code = INDEX_SIZE_ERR\r
-\r
-class DomstringSizeErr(DOMException):\r
- code = DOMSTRING_SIZE_ERR\r
-\r
-class HierarchyRequestErr(DOMException):\r
- code = HIERARCHY_REQUEST_ERR\r
-\r
-class WrongDocumentErr(DOMException):\r
- code = WRONG_DOCUMENT_ERR\r
-\r
-class InvalidCharacterErr(DOMException):\r
- code = INVALID_CHARACTER_ERR\r
-\r
-class NoDataAllowedErr(DOMException):\r
- code = NO_DATA_ALLOWED_ERR\r
-\r
-class NoModificationAllowedErr(DOMException):\r
- code = NO_MODIFICATION_ALLOWED_ERR\r
-\r
-class NotFoundErr(DOMException):\r
- code = NOT_FOUND_ERR\r
-\r
-class NotSupportedErr(DOMException):\r
- code = NOT_SUPPORTED_ERR\r
-\r
-class InuseAttributeErr(DOMException):\r
- code = INUSE_ATTRIBUTE_ERR\r
-\r
-class InvalidStateErr(DOMException):\r
- code = INVALID_STATE_ERR\r
-\r
-class SyntaxErr(DOMException):\r
- code = SYNTAX_ERR\r
-\r
-class InvalidModificationErr(DOMException):\r
- code = INVALID_MODIFICATION_ERR\r
-\r
-class NamespaceErr(DOMException):\r
- code = NAMESPACE_ERR\r
-\r
-class InvalidAccessErr(DOMException):\r
- code = INVALID_ACCESS_ERR\r
-\r
-class ValidationErr(DOMException):\r
- code = VALIDATION_ERR\r
-\r
-class UserDataHandler:\r
- """Class giving the operation constants for UserDataHandler.handle()."""\r
-\r
- # Based on DOM Level 3 (WD 9 April 2002)\r
-\r
- NODE_CLONED = 1\r
- NODE_IMPORTED = 2\r
- NODE_DELETED = 3\r
- NODE_RENAMED = 4\r
-\r
-XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"\r
-XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"\r
-XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"\r
-EMPTY_NAMESPACE = None\r
-EMPTY_PREFIX = None\r
-\r
-from domreg import getDOMImplementation,registerDOMImplementation\r