Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="prev" href="dom-example.html" /> | |
13 | <link rel="parent" href="module-xml.dom.minidom.html" /> | |
14 | <link rel="next" href="module-xml.dom.pulldom.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>13.7.3 minidom and the DOM standard </title> | |
17 | </head> | |
18 | <body> | |
19 | <DIV CLASS="navigation"> | |
20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
22 | <tr> | |
23 | <td class='online-navigation'><a rel="prev" title="13.7.2 DOM Example" | |
24 | href="dom-example.html"><img src='../icons/previous.png' | |
25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
26 | <td class='online-navigation'><a rel="parent" title="13.7 xml.dom.minidom " | |
27 | href="module-xml.dom.minidom.html"><img src='../icons/up.png' | |
28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
29 | <td class='online-navigation'><a rel="next" title="13.8 xml.dom.pulldom " | |
30 | href="module-xml.dom.pulldom.html"><img src='../icons/next.png' | |
31 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
32 | <td align="center" width="100%">Python Library Reference</td> | |
33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
34 | href="contents.html"><img src='../icons/contents.png' | |
35 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
37 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
38 | <td class='online-navigation'><a rel="index" title="Index" | |
39 | href="genindex.html"><img src='../icons/index.png' | |
40 | border='0' height='32' alt='Index' width='32' /></A></td> | |
41 | </tr></table> | |
42 | <div class='online-navigation'> | |
43 | <b class="navlabel">Previous:</b> | |
44 | <a class="sectref" rel="prev" href="dom-example.html">13.7.2 DOM Example</A> | |
45 | <b class="navlabel">Up:</b> | |
46 | <a class="sectref" rel="parent" href="module-xml.dom.minidom.html">13.7 xml.dom.minidom </A> | |
47 | <b class="navlabel">Next:</b> | |
48 | <a class="sectref" rel="next" href="module-xml.dom.pulldom.html">13.8 xml.dom.pulldom </A> | |
49 | </div> | |
50 | <hr /></div> | |
51 | </DIV> | |
52 | <!--End of Navigation Panel--> | |
53 | ||
54 | <H2><A NAME="SECTION0015730000000000000000"></A><A NAME="minidom-and-dom"></A> | |
55 | <BR> | |
56 | 13.7.3 minidom and the DOM standard | |
57 | </H2> | |
58 | ||
59 | <P> | |
60 | The <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt> module is essentially a DOM | |
61 | 1.0-compatible DOM with some DOM 2 features (primarily namespace | |
62 | features). | |
63 | ||
64 | <P> | |
65 | Usage of the DOM interface in Python is straight-forward. The | |
66 | following mapping rules apply: | |
67 | ||
68 | <P> | |
69 | ||
70 | <UL> | |
71 | <LI>Interfaces are accessed through instance objects. Applications | |
72 | should not instantiate the classes themselves; they should use | |
73 | the creator functions available on the <tt class="class">Document</tt> object. | |
74 | Derived interfaces support all operations (and attributes) from | |
75 | the base interfaces, plus any new operations. | |
76 | ||
77 | <P> | |
78 | </LI> | |
79 | <LI>Operations are used as methods. Since the DOM uses only | |
80 | <tt class="keyword">in</tt> parameters, the arguments are passed in normal | |
81 | order (from left to right). There are no optional | |
82 | arguments. <tt class="keyword">void</tt> operations return <code>None</code>. | |
83 | ||
84 | <P> | |
85 | </LI> | |
86 | <LI>IDL attributes map to instance attributes. For compatibility | |
87 | with the OMG IDL language mapping for Python, an attribute | |
88 | <code>foo</code> can also be accessed through accessor methods | |
89 | <tt class="method">_get_foo()</tt> and <tt class="method">_set_foo()</tt>. <tt class="keyword">readonly</tt> | |
90 | attributes must not be changed; this is not enforced at | |
91 | runtime. | |
92 | ||
93 | <P> | |
94 | </LI> | |
95 | <LI>The types <code>short int</code>, <code>unsigned int</code>, <code>unsigned | |
96 | long long</code>, and <code>boolean</code> all map to Python integer | |
97 | objects. | |
98 | ||
99 | <P> | |
100 | </LI> | |
101 | <LI>The type <code>DOMString</code> maps to Python strings. | |
102 | <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt> supports either byte or Unicode | |
103 | strings, but will normally produce Unicode strings. Values | |
104 | of type <code>DOMString</code> may also be <code>None</code> where allowed | |
105 | to have the IDL <code>null</code> value by the DOM specification from | |
106 | the W3C. | |
107 | ||
108 | <P> | |
109 | </LI> | |
110 | <LI><tt class="keyword">const</tt> declarations map to variables in their | |
111 | respective scope | |
112 | (e.g. <code>xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE</code>); | |
113 | they must not be changed. | |
114 | ||
115 | <P> | |
116 | </LI> | |
117 | <LI><code>DOMException</code> is currently not supported in | |
118 | <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt>. Instead, | |
119 | <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt> uses standard Python exceptions such | |
120 | as <tt class="exception">TypeError</tt> and <tt class="exception">AttributeError</tt>. | |
121 | ||
122 | <P> | |
123 | </LI> | |
124 | <LI><tt class="class">NodeList</tt> objects are implemented using Python's built-in | |
125 | list type. Starting with Python 2.2, these objects provide the | |
126 | interface defined in the DOM specification, but with earlier | |
127 | versions of Python they do not support the official API. They | |
128 | are, however, much more ``Pythonic'' than the interface defined | |
129 | in the W3C recommendations. | |
130 | </LI> | |
131 | </UL> | |
132 | ||
133 | <P> | |
134 | The following interfaces have no implementation in | |
135 | <tt class="module"><a href="module-xml.dom.minidom.html">xml.dom.minidom</a></tt>: | |
136 | ||
137 | <P> | |
138 | ||
139 | <UL> | |
140 | <LI><tt class="class">DOMTimeStamp</tt> | |
141 | ||
142 | <P> | |
143 | </LI> | |
144 | <LI><tt class="class">DocumentType</tt> (added in Python 2.1) | |
145 | ||
146 | <P> | |
147 | </LI> | |
148 | <LI><tt class="class">DOMImplementation</tt> (added in Python 2.1) | |
149 | ||
150 | <P> | |
151 | </LI> | |
152 | <LI><tt class="class">CharacterData</tt> | |
153 | ||
154 | <P> | |
155 | </LI> | |
156 | <LI><tt class="class">CDATASection</tt> | |
157 | ||
158 | <P> | |
159 | </LI> | |
160 | <LI><tt class="class">Notation</tt> | |
161 | ||
162 | <P> | |
163 | </LI> | |
164 | <LI><tt class="class">Entity</tt> | |
165 | ||
166 | <P> | |
167 | </LI> | |
168 | <LI><tt class="class">EntityReference</tt> | |
169 | ||
170 | <P> | |
171 | </LI> | |
172 | <LI><tt class="class">DocumentFragment</tt> | |
173 | </LI> | |
174 | </UL> | |
175 | ||
176 | <P> | |
177 | Most of these reflect information in the XML document that is not of | |
178 | general utility to most DOM users. | |
179 | ||
180 | <DIV CLASS="navigation"> | |
181 | <div class='online-navigation'> | |
182 | <p></p><hr /> | |
183 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
184 | <tr> | |
185 | <td class='online-navigation'><a rel="prev" title="13.7.2 DOM Example" | |
186 | href="dom-example.html"><img src='../icons/previous.png' | |
187 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
188 | <td class='online-navigation'><a rel="parent" title="13.7 xml.dom.minidom " | |
189 | href="module-xml.dom.minidom.html"><img src='../icons/up.png' | |
190 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
191 | <td class='online-navigation'><a rel="next" title="13.8 xml.dom.pulldom " | |
192 | href="module-xml.dom.pulldom.html"><img src='../icons/next.png' | |
193 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
194 | <td align="center" width="100%">Python Library Reference</td> | |
195 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
196 | href="contents.html"><img src='../icons/contents.png' | |
197 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
198 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
199 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
200 | <td class='online-navigation'><a rel="index" title="Index" | |
201 | href="genindex.html"><img src='../icons/index.png' | |
202 | border='0' height='32' alt='Index' width='32' /></A></td> | |
203 | </tr></table> | |
204 | <div class='online-navigation'> | |
205 | <b class="navlabel">Previous:</b> | |
206 | <a class="sectref" rel="prev" href="dom-example.html">13.7.2 DOM Example</A> | |
207 | <b class="navlabel">Up:</b> | |
208 | <a class="sectref" rel="parent" href="module-xml.dom.minidom.html">13.7 xml.dom.minidom </A> | |
209 | <b class="navlabel">Next:</b> | |
210 | <a class="sectref" rel="next" href="module-xml.dom.pulldom.html">13.8 xml.dom.pulldom </A> | |
211 | </div> | |
212 | </div> | |
213 | <hr /> | |
214 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
215 | </DIV> | |
216 | <!--End of Navigation Panel--> | |
217 | <ADDRESS> | |
218 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
219 | </ADDRESS> | |
220 | </BODY> | |
221 | </HTML> |