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