Commit | Line | Data |
---|---|---|
920dae64 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="next" href="dom-attr-objects.html" /> | |
13 | <link rel="prev" href="dom-document-objects.html" /> | |
14 | <link rel="parent" href="node652.html" /> | |
15 | <link rel="next" href="dom-attr-objects.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>13.6.2.6 Element Objects </title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="13.6.2.5 Document Objects" | |
25 | href="dom-document-objects.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="13.6.2 Objects in the" | |
28 | href="node652.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="13.6.2.7 Attr Objects" | |
31 | href="dom-attr-objects.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="dom-document-objects.html">13.6.2.5 Document Objects</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="node652.html">13.6.2 Objects in the</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="dom-attr-objects.html">13.6.2.7 Attr Objects</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H3><A NAME="SECTION0015626000000000000000"></A><A NAME="dom-element-objects"></A> | |
56 | <BR> | |
57 | 13.6.2.6 Element Objects | |
58 | </H3> | |
59 | ||
60 | <P> | |
61 | <tt class="class">Element</tt> is a subclass of <tt class="class">Node</tt>, so inherits all the | |
62 | attributes of that class. | |
63 | ||
64 | <P> | |
65 | <dl><dt><b><tt id='l2h-4403' xml:id='l2h-4403' class="member">tagName</tt></b></dt> | |
66 | <dd> | |
67 | The element type name. In a namespace-using document it may have | |
68 | colons in it. The value is a string. | |
69 | </dl> | |
70 | ||
71 | <P> | |
72 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
73 | <td><nobr><b><tt id='l2h-4404' xml:id='l2h-4404' class="method">getElementsByTagName</tt></b>(</nobr></td> | |
74 | <td><var>tagName</var>)</td></tr></table></dt> | |
75 | <dd> | |
76 | Same as equivalent method in the <tt class="class">Document</tt> class. | |
77 | </dl> | |
78 | ||
79 | <P> | |
80 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
81 | <td><nobr><b><tt id='l2h-4405' xml:id='l2h-4405' class="method">getElementsByTagNameNS</tt></b>(</nobr></td> | |
82 | <td><var>tagName</var>)</td></tr></table></dt> | |
83 | <dd> | |
84 | Same as equivalent method in the <tt class="class">Document</tt> class. | |
85 | </dl> | |
86 | ||
87 | <P> | |
88 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
89 | <td><nobr><b><tt id='l2h-4406' xml:id='l2h-4406' class="method">hasAttribute</tt></b>(</nobr></td> | |
90 | <td><var>name</var>)</td></tr></table></dt> | |
91 | <dd> | |
92 | Returns true if the element has an attribute named by <var>name</var>. | |
93 | </dl> | |
94 | ||
95 | <P> | |
96 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
97 | <td><nobr><b><tt id='l2h-4407' xml:id='l2h-4407' class="method">hasAttributeNS</tt></b>(</nobr></td> | |
98 | <td><var>namespaceURI, localName</var>)</td></tr></table></dt> | |
99 | <dd> | |
100 | Returns true if the element has an attribute named by | |
101 | <var>namespaceURI</var> and <var>localName</var>. | |
102 | </dl> | |
103 | ||
104 | <P> | |
105 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
106 | <td><nobr><b><tt id='l2h-4408' xml:id='l2h-4408' class="method">getAttribute</tt></b>(</nobr></td> | |
107 | <td><var>name</var>)</td></tr></table></dt> | |
108 | <dd> | |
109 | Return the value of the attribute named by <var>name</var> as a | |
110 | string. If no such attribute exists, an empty string is returned, | |
111 | as if the attribute had no value. | |
112 | </dl> | |
113 | ||
114 | <P> | |
115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
116 | <td><nobr><b><tt id='l2h-4409' xml:id='l2h-4409' class="method">getAttributeNode</tt></b>(</nobr></td> | |
117 | <td><var>attrname</var>)</td></tr></table></dt> | |
118 | <dd> | |
119 | Return the <tt class="class">Attr</tt> node for the attribute named by | |
120 | <var>attrname</var>. | |
121 | </dl> | |
122 | ||
123 | <P> | |
124 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
125 | <td><nobr><b><tt id='l2h-4410' xml:id='l2h-4410' class="method">getAttributeNS</tt></b>(</nobr></td> | |
126 | <td><var>namespaceURI, localName</var>)</td></tr></table></dt> | |
127 | <dd> | |
128 | Return the value of the attribute named by <var>namespaceURI</var> and | |
129 | <var>localName</var> as a string. If no such attribute exists, an empty | |
130 | string is returned, as if the attribute had no value. | |
131 | </dl> | |
132 | ||
133 | <P> | |
134 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
135 | <td><nobr><b><tt id='l2h-4411' xml:id='l2h-4411' class="method">getAttributeNodeNS</tt></b>(</nobr></td> | |
136 | <td><var>namespaceURI, localName</var>)</td></tr></table></dt> | |
137 | <dd> | |
138 | Return an attribute value as a node, given a <var>namespaceURI</var> and | |
139 | <var>localName</var>. | |
140 | </dl> | |
141 | ||
142 | <P> | |
143 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
144 | <td><nobr><b><tt id='l2h-4412' xml:id='l2h-4412' class="method">removeAttribute</tt></b>(</nobr></td> | |
145 | <td><var>name</var>)</td></tr></table></dt> | |
146 | <dd> | |
147 | Remove an attribute by name. No exception is raised if there is no | |
148 | matching attribute. | |
149 | </dl> | |
150 | ||
151 | <P> | |
152 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
153 | <td><nobr><b><tt id='l2h-4413' xml:id='l2h-4413' class="method">removeAttributeNode</tt></b>(</nobr></td> | |
154 | <td><var>oldAttr</var>)</td></tr></table></dt> | |
155 | <dd> | |
156 | Remove and return <var>oldAttr</var> from the attribute list, if present. | |
157 | If <var>oldAttr</var> is not present, <tt class="exception">NotFoundErr</tt> is raised. | |
158 | </dl> | |
159 | ||
160 | <P> | |
161 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
162 | <td><nobr><b><tt id='l2h-4414' xml:id='l2h-4414' class="method">removeAttributeNS</tt></b>(</nobr></td> | |
163 | <td><var>namespaceURI, localName</var>)</td></tr></table></dt> | |
164 | <dd> | |
165 | Remove an attribute by name. Note that it uses a localName, not a | |
166 | qname. No exception is raised if there is no matching attribute. | |
167 | </dl> | |
168 | ||
169 | <P> | |
170 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
171 | <td><nobr><b><tt id='l2h-4415' xml:id='l2h-4415' class="method">setAttribute</tt></b>(</nobr></td> | |
172 | <td><var>name, value</var>)</td></tr></table></dt> | |
173 | <dd> | |
174 | Set an attribute value from a string. | |
175 | </dl> | |
176 | ||
177 | <P> | |
178 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
179 | <td><nobr><b><tt id='l2h-4416' xml:id='l2h-4416' class="method">setAttributeNode</tt></b>(</nobr></td> | |
180 | <td><var>newAttr</var>)</td></tr></table></dt> | |
181 | <dd> | |
182 | Add a new attribute node to the element, replacing an existing | |
183 | attribute if necessary if the <tt class="member">name</tt> attribute matches. If a | |
184 | replacement occurs, the old attribute node will be returned. If | |
185 | <var>newAttr</var> is already in use, <tt class="exception">InuseAttributeErr</tt> will be | |
186 | raised. | |
187 | </dl> | |
188 | ||
189 | <P> | |
190 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
191 | <td><nobr><b><tt id='l2h-4417' xml:id='l2h-4417' class="method">setAttributeNodeNS</tt></b>(</nobr></td> | |
192 | <td><var>newAttr</var>)</td></tr></table></dt> | |
193 | <dd> | |
194 | Add a new attribute node to the element, replacing an existing | |
195 | attribute if necessary if the <tt class="member">namespaceURI</tt> and | |
196 | <tt class="member">localName</tt> attributes match. If a replacement occurs, the old | |
197 | attribute node will be returned. If <var>newAttr</var> is already in use, | |
198 | <tt class="exception">InuseAttributeErr</tt> will be raised. | |
199 | </dl> | |
200 | ||
201 | <P> | |
202 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
203 | <td><nobr><b><tt id='l2h-4418' xml:id='l2h-4418' class="method">setAttributeNS</tt></b>(</nobr></td> | |
204 | <td><var>namespaceURI, qname, value</var>)</td></tr></table></dt> | |
205 | <dd> | |
206 | Set an attribute value from a string, given a <var>namespaceURI</var> and a | |
207 | <var>qname</var>. Note that a qname is the whole attribute name. This is | |
208 | different than above. | |
209 | </dl> | |
210 | ||
211 | <P> | |
212 | ||
213 | <DIV CLASS="navigation"> | |
214 | <div class='online-navigation'> | |
215 | <p></p><hr /> | |
216 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
217 | <tr> | |
218 | <td class='online-navigation'><a rel="prev" title="13.6.2.5 Document Objects" | |
219 | href="dom-document-objects.html"><img src='../icons/previous.png' | |
220 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
221 | <td class='online-navigation'><a rel="parent" title="13.6.2 Objects in the" | |
222 | href="node652.html"><img src='../icons/up.png' | |
223 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
224 | <td class='online-navigation'><a rel="next" title="13.6.2.7 Attr Objects" | |
225 | href="dom-attr-objects.html"><img src='../icons/next.png' | |
226 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
227 | <td align="center" width="100%">Python Library Reference</td> | |
228 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
229 | href="contents.html"><img src='../icons/contents.png' | |
230 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
231 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
232 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
233 | <td class='online-navigation'><a rel="index" title="Index" | |
234 | href="genindex.html"><img src='../icons/index.png' | |
235 | border='0' height='32' alt='Index' width='32' /></A></td> | |
236 | </tr></table> | |
237 | <div class='online-navigation'> | |
238 | <b class="navlabel">Previous:</b> | |
239 | <a class="sectref" rel="prev" href="dom-document-objects.html">13.6.2.5 Document Objects</A> | |
240 | <b class="navlabel">Up:</b> | |
241 | <a class="sectref" rel="parent" href="node652.html">13.6.2 Objects in the</A> | |
242 | <b class="navlabel">Next:</b> | |
243 | <a class="sectref" rel="next" href="dom-attr-objects.html">13.6.2.7 Attr Objects</A> | |
244 | </div> | |
245 | </div> | |
246 | <hr /> | |
247 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
248 | </DIV> | |
249 | <!--End of Navigation Panel--> | |
250 | <ADDRESS> | |
251 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
252 | </ADDRESS> | |
253 | </BODY> | |
254 | </HTML> |