ยปCore Development>Code coverage>Lib/xml/dom/__init__.py

Python code coverage for Lib/xml/dom/__init__.py

#countcontent
1n/a"""W3C Document Object Model implementation for Python.
2n/a
3n/aThe Python mapping of the Document Object Model is documented in the
4n/aPython Library Reference in the section on the xml.dom package.
5n/a
6n/aThis package contains the following modules:
7n/a
8n/aminidom -- A simple implementation of the Level 1 DOM with namespace
9n/a support added (based on the Level 2 specification) and other
10n/a minor Level 2 functionality.
11n/a
12n/apulldom -- DOM builder supporting on-demand tree-building for selected
13n/a subtrees of the document.
14n/a
15n/a"""
16n/a
17n/a
18n/aclass Node:
19n/a """Class giving the NodeType constants."""
20n/a __slots__ = ()
21n/a
22n/a # DOM implementations may use this as a base class for their own
23n/a # Node implementations. If they don't, the constants defined here
24n/a # should still be used as the canonical definitions as they match
25n/a # the values given in the W3C recommendation. Client code can
26n/a # safely refer to these values in all tests of Node.nodeType
27n/a # values.
28n/a
29n/a ELEMENT_NODE = 1
30n/a ATTRIBUTE_NODE = 2
31n/a TEXT_NODE = 3
32n/a CDATA_SECTION_NODE = 4
33n/a ENTITY_REFERENCE_NODE = 5
34n/a ENTITY_NODE = 6
35n/a PROCESSING_INSTRUCTION_NODE = 7
36n/a COMMENT_NODE = 8
37n/a DOCUMENT_NODE = 9
38n/a DOCUMENT_TYPE_NODE = 10
39n/a DOCUMENT_FRAGMENT_NODE = 11
40n/a NOTATION_NODE = 12
41n/a
42n/a
43n/a#ExceptionCode
44n/aINDEX_SIZE_ERR = 1
45n/aDOMSTRING_SIZE_ERR = 2
46n/aHIERARCHY_REQUEST_ERR = 3
47n/aWRONG_DOCUMENT_ERR = 4
48n/aINVALID_CHARACTER_ERR = 5
49n/aNO_DATA_ALLOWED_ERR = 6
50n/aNO_MODIFICATION_ALLOWED_ERR = 7
51n/aNOT_FOUND_ERR = 8
52n/aNOT_SUPPORTED_ERR = 9
53n/aINUSE_ATTRIBUTE_ERR = 10
54n/aINVALID_STATE_ERR = 11
55n/aSYNTAX_ERR = 12
56n/aINVALID_MODIFICATION_ERR = 13
57n/aNAMESPACE_ERR = 14
58n/aINVALID_ACCESS_ERR = 15
59n/aVALIDATION_ERR = 16
60n/a
61n/a
62n/aclass DOMException(Exception):
63n/a """Abstract base class for DOM exceptions.
64n/a Exceptions with specific codes are specializations of this class."""
65n/a
66n/a def __init__(self, *args, **kw):
67n/a if self.__class__ is DOMException:
68n/a raise RuntimeError(
69n/a "DOMException should not be instantiated directly")
70n/a Exception.__init__(self, *args, **kw)
71n/a
72n/a def _get_code(self):
73n/a return self.code
74n/a
75n/a
76n/aclass IndexSizeErr(DOMException):
77n/a code = INDEX_SIZE_ERR
78n/a
79n/aclass DomstringSizeErr(DOMException):
80n/a code = DOMSTRING_SIZE_ERR
81n/a
82n/aclass HierarchyRequestErr(DOMException):
83n/a code = HIERARCHY_REQUEST_ERR
84n/a
85n/aclass WrongDocumentErr(DOMException):
86n/a code = WRONG_DOCUMENT_ERR
87n/a
88n/aclass InvalidCharacterErr(DOMException):
89n/a code = INVALID_CHARACTER_ERR
90n/a
91n/aclass NoDataAllowedErr(DOMException):
92n/a code = NO_DATA_ALLOWED_ERR
93n/a
94n/aclass NoModificationAllowedErr(DOMException):
95n/a code = NO_MODIFICATION_ALLOWED_ERR
96n/a
97n/aclass NotFoundErr(DOMException):
98n/a code = NOT_FOUND_ERR
99n/a
100n/aclass NotSupportedErr(DOMException):
101n/a code = NOT_SUPPORTED_ERR
102n/a
103n/aclass InuseAttributeErr(DOMException):
104n/a code = INUSE_ATTRIBUTE_ERR
105n/a
106n/aclass InvalidStateErr(DOMException):
107n/a code = INVALID_STATE_ERR
108n/a
109n/aclass SyntaxErr(DOMException):
110n/a code = SYNTAX_ERR
111n/a
112n/aclass InvalidModificationErr(DOMException):
113n/a code = INVALID_MODIFICATION_ERR
114n/a
115n/aclass NamespaceErr(DOMException):
116n/a code = NAMESPACE_ERR
117n/a
118n/aclass InvalidAccessErr(DOMException):
119n/a code = INVALID_ACCESS_ERR
120n/a
121n/aclass ValidationErr(DOMException):
122n/a code = VALIDATION_ERR
123n/a
124n/aclass UserDataHandler:
125n/a """Class giving the operation constants for UserDataHandler.handle()."""
126n/a
127n/a # Based on DOM Level 3 (WD 9 April 2002)
128n/a
129n/a NODE_CLONED = 1
130n/a NODE_IMPORTED = 2
131n/a NODE_DELETED = 3
132n/a NODE_RENAMED = 4
133n/a
134n/aXML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"
135n/aXMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"
136n/aXHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"
137n/aEMPTY_NAMESPACE = None
138n/aEMPTY_PREFIX = None
139n/a
140n/afrom .domreg import getDOMImplementation, registerDOMImplementation