PyXR

c:\python24\lib \ xml \ dom

Subpackages:

Modules

Init code



0001 """W3C Document Object Model implementation for Python.
0002 
0003 The Python mapping of the Document Object Model is documented in the
0004 Python Library Reference in the section on the xml.dom package.
0005 
0006 This package contains the following modules:
0007 
0008 minidom -- A simple implementation of the Level 1 DOM with namespace
0009            support added (based on the Level 2 specification) and other
0010            minor Level 2 functionality.
0011 
0012 pulldom -- DOM builder supporting on-demand tree-building for selected
0013            subtrees of the document.
0014 
0015 """
0016 
0017 
0018 class Node:
0019     """Class giving the NodeType constants."""
0020 
0021     # DOM implementations may use this as a base class for their own
0022     # Node implementations.  If they don't, the constants defined here
0023     # should still be used as the canonical definitions as they match
0024     # the values given in the W3C recommendation.  Client code can
0025     # safely refer to these values in all tests of Node.nodeType
0026     # values.
0027 
0028     ELEMENT_NODE                = 1
0029     ATTRIBUTE_NODE              = 2
0030     TEXT_NODE                   = 3
0031     CDATA_SECTION_NODE          = 4
0032     ENTITY_REFERENCE_NODE       = 5
0033     ENTITY_NODE                 = 6
0034     PROCESSING_INSTRUCTION_NODE = 7
0035     COMMENT_NODE                = 8
0036     DOCUMENT_NODE               = 9
0037     DOCUMENT_TYPE_NODE          = 10
0038     DOCUMENT_FRAGMENT_NODE      = 11
0039     NOTATION_NODE               = 12
0040 
0041 
0042 #ExceptionCode
0043 INDEX_SIZE_ERR                 = 1
0044 DOMSTRING_SIZE_ERR             = 2
0045 HIERARCHY_REQUEST_ERR          = 3
0046 WRONG_DOCUMENT_ERR             = 4
0047 INVALID_CHARACTER_ERR          = 5
0048 NO_DATA_ALLOWED_ERR            = 6
0049 NO_MODIFICATION_ALLOWED_ERR    = 7
0050 NOT_FOUND_ERR                  = 8
0051 NOT_SUPPORTED_ERR              = 9
0052 INUSE_ATTRIBUTE_ERR            = 10
0053 INVALID_STATE_ERR              = 11
0054 SYNTAX_ERR                     = 12
0055 INVALID_MODIFICATION_ERR       = 13
0056 NAMESPACE_ERR                  = 14
0057 INVALID_ACCESS_ERR             = 15
0058 VALIDATION_ERR                 = 16
0059 
0060 
0061 class DOMException(Exception):
0062     """Abstract base class for DOM exceptions.
0063     Exceptions with specific codes are specializations of this class."""
0064 
0065     def __init__(self, *args, **kw):
0066         if self.__class__ is DOMException:
0067             raise RuntimeError(
0068                 "DOMException should not be instantiated directly")
0069         Exception.__init__(self, *args, **kw)
0070 
0071     def _get_code(self):
0072         return self.code
0073 
0074 
0075 class IndexSizeErr(DOMException):
0076     code = INDEX_SIZE_ERR
0077 
0078 class DomstringSizeErr(DOMException):
0079     code = DOMSTRING_SIZE_ERR
0080 
0081 class HierarchyRequestErr(DOMException):
0082     code = HIERARCHY_REQUEST_ERR
0083 
0084 class WrongDocumentErr(DOMException):
0085     code = WRONG_DOCUMENT_ERR
0086 
0087 class InvalidCharacterErr(DOMException):
0088     code = INVALID_CHARACTER_ERR
0089 
0090 class NoDataAllowedErr(DOMException):
0091     code = NO_DATA_ALLOWED_ERR
0092 
0093 class NoModificationAllowedErr(DOMException):
0094     code = NO_MODIFICATION_ALLOWED_ERR
0095 
0096 class NotFoundErr(DOMException):
0097     code = NOT_FOUND_ERR
0098 
0099 class NotSupportedErr(DOMException):
0100     code = NOT_SUPPORTED_ERR
0101 
0102 class InuseAttributeErr(DOMException):
0103     code = INUSE_ATTRIBUTE_ERR
0104 
0105 class InvalidStateErr(DOMException):
0106     code = INVALID_STATE_ERR
0107 
0108 class SyntaxErr(DOMException):
0109     code = SYNTAX_ERR
0110 
0111 class InvalidModificationErr(DOMException):
0112     code = INVALID_MODIFICATION_ERR
0113 
0114 class NamespaceErr(DOMException):
0115     code = NAMESPACE_ERR
0116 
0117 class InvalidAccessErr(DOMException):
0118     code = INVALID_ACCESS_ERR
0119 
0120 class ValidationErr(DOMException):
0121     code = VALIDATION_ERR
0122 
0123 class UserDataHandler:
0124     """Class giving the operation constants for UserDataHandler.handle()."""
0125 
0126     # Based on DOM Level 3 (WD 9 April 2002)
0127 
0128     NODE_CLONED   = 1
0129     NODE_IMPORTED = 2
0130     NODE_DELETED  = 3
0131     NODE_RENAMED  = 4
0132 
0133 XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"
0134 XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"
0135 XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"
0136 EMPTY_NAMESPACE = None
0137 EMPTY_PREFIX = None
0138 
0139 from domreg import getDOMImplementation,registerDOMImplementation
0140 

Generated by PyXR 0.9.4
SourceForge.net Logo