<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"lib.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"lib.html" title='Python Library Reference'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"dom-attr-objects.html" />
<link rel=
"prev" href=
"dom-document-objects.html" />
<link rel=
"parent" href=
"node652.html" />
<link rel=
"next" href=
"dom-attr-objects.html" />
<meta name='aesop' content='information'
/>
<title>13.6.2.6 Element Objects
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"13.6.2.5 Document Objects"
href=
"dom-document-objects.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"13.6.2 Objects in the"
href=
"node652.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"13.6.2.7 Attr Objects"
href=
"dom-attr-objects.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"dom-document-objects.html">13.6.2.5 Document Objects
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"node652.html">13.6.2 Objects in the
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"dom-attr-objects.html">13.6.2.7 Attr Objects
</A>
<!--End of Navigation Panel-->
<H3><A NAME=
"SECTION0015626000000000000000"></A><A NAME=
"dom-element-objects"></A>
<tt class=
"class">Element
</tt> is a subclass of
<tt class=
"class">Node
</tt>, so inherits all the
attributes of that class.
<dl><dt><b><tt id='l2h-
4403' xml:id='l2h-
4403'
class=
"member">tagName
</tt></b></dt>
The element type name. In a namespace-using document it may have
colons in it. The value is a string.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4404' xml:id='l2h-
4404'
class=
"method">getElementsByTagName
</tt></b>(
</nobr></td>
<td><var>tagName
</var>)
</td></tr></table></dt>
Same as equivalent method in the
<tt class=
"class">Document
</tt> class.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4405' xml:id='l2h-
4405'
class=
"method">getElementsByTagNameNS
</tt></b>(
</nobr></td>
<td><var>tagName
</var>)
</td></tr></table></dt>
Same as equivalent method in the
<tt class=
"class">Document
</tt> class.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4406' xml:id='l2h-
4406'
class=
"method">hasAttribute
</tt></b>(
</nobr></td>
<td><var>name
</var>)
</td></tr></table></dt>
Returns true if the element has an attribute named by
<var>name
</var>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4407' xml:id='l2h-
4407'
class=
"method">hasAttributeNS
</tt></b>(
</nobr></td>
<td><var>namespaceURI, localName
</var>)
</td></tr></table></dt>
Returns true if the element has an attribute named by
<var>namespaceURI
</var> and
<var>localName
</var>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4408' xml:id='l2h-
4408'
class=
"method">getAttribute
</tt></b>(
</nobr></td>
<td><var>name
</var>)
</td></tr></table></dt>
Return the value of the attribute named by
<var>name
</var> as a
string. If no such attribute exists, an empty string is returned,
as if the attribute had no value.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4409' xml:id='l2h-
4409'
class=
"method">getAttributeNode
</tt></b>(
</nobr></td>
<td><var>attrname
</var>)
</td></tr></table></dt>
Return the
<tt class=
"class">Attr
</tt> node for the attribute named by
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4410' xml:id='l2h-
4410'
class=
"method">getAttributeNS
</tt></b>(
</nobr></td>
<td><var>namespaceURI, localName
</var>)
</td></tr></table></dt>
Return the value of the attribute named by
<var>namespaceURI
</var> and
<var>localName
</var> as a string. If no such attribute exists, an empty
string is returned, as if the attribute had no value.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4411' xml:id='l2h-
4411'
class=
"method">getAttributeNodeNS
</tt></b>(
</nobr></td>
<td><var>namespaceURI, localName
</var>)
</td></tr></table></dt>
Return an attribute value as a node, given a
<var>namespaceURI
</var> and
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4412' xml:id='l2h-
4412'
class=
"method">removeAttribute
</tt></b>(
</nobr></td>
<td><var>name
</var>)
</td></tr></table></dt>
Remove an attribute by name. No exception is raised if there is no
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4413' xml:id='l2h-
4413'
class=
"method">removeAttributeNode
</tt></b>(
</nobr></td>
<td><var>oldAttr
</var>)
</td></tr></table></dt>
Remove and return
<var>oldAttr
</var> from the attribute list, if present.
If
<var>oldAttr
</var> is not present,
<tt class=
"exception">NotFoundErr
</tt> is raised.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4414' xml:id='l2h-
4414'
class=
"method">removeAttributeNS
</tt></b>(
</nobr></td>
<td><var>namespaceURI, localName
</var>)
</td></tr></table></dt>
Remove an attribute by name. Note that it uses a localName, not a
qname. No exception is raised if there is no matching attribute.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4415' xml:id='l2h-
4415'
class=
"method">setAttribute
</tt></b>(
</nobr></td>
<td><var>name, value
</var>)
</td></tr></table></dt>
Set an attribute value from a string.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4416' xml:id='l2h-
4416'
class=
"method">setAttributeNode
</tt></b>(
</nobr></td>
<td><var>newAttr
</var>)
</td></tr></table></dt>
Add a new attribute node to the element, replacing an existing
attribute if necessary if the
<tt class=
"member">name
</tt> attribute matches. If a
replacement occurs, the old attribute node will be returned. If
<var>newAttr
</var> is already in use,
<tt class=
"exception">InuseAttributeErr
</tt> will be
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4417' xml:id='l2h-
4417'
class=
"method">setAttributeNodeNS
</tt></b>(
</nobr></td>
<td><var>newAttr
</var>)
</td></tr></table></dt>
Add a new attribute node to the element, replacing an existing
attribute if necessary if the
<tt class=
"member">namespaceURI
</tt> and
<tt class=
"member">localName
</tt> attributes match. If a replacement occurs, the old
attribute node will be returned. If
<var>newAttr
</var> is already in use,
<tt class=
"exception">InuseAttributeErr
</tt> will be raised.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
4418' xml:id='l2h-
4418'
class=
"method">setAttributeNS
</tt></b>(
</nobr></td>
<td><var>namespaceURI, qname, value
</var>)
</td></tr></table></dt>
Set an attribute value from a string, given a
<var>namespaceURI
</var> and a
<var>qname
</var>. Note that a qname is the whole attribute name. This is
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"13.6.2.5 Document Objects"
href=
"dom-document-objects.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"13.6.2 Objects in the"
href=
"node652.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"13.6.2.7 Attr Objects"
href=
"dom-attr-objects.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"dom-document-objects.html">13.6.2.5 Document Objects
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"node652.html">13.6.2 Objects in the
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"dom-attr-objects.html">13.6.2.7 Attr Objects
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.