<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <link rel="STYLESHEET" href="lib.css" type='text/css' /> <link rel="SHORTCUT ICON" href="../icons/pyfav.gif" /> <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="node565.html"> <LINK rel="next" href="dom-attr-objects.html"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name='aesop' content='information' /> <META name="description" content="Element Objects "> <META name="keywords" content="lib"> <META name="resource-type" content="document"> <META name="distribution" content="global"> <title>13.6.2.6 Element Objects </title> </head> <body> <DIV CLASS="navigation"> <div id='top-navigation-panel'> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <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="node565.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> </tr></table> <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="node565.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> </div> <hr /></div> </DIV> <!--End of Navigation Panel--> <H3><A NAME="SECTION0015626000000000000000"><!--x--></A><A NAME="dom-element-objects"><!--z--></A> <BR> 13.6.2.6 Element Objects </H3> <P> <tt class="class">Element</tt> is a subclass of <tt class="class">Node</tt>, so inherits all the attributes of that class. <P> <dl><dt><b><tt id='l2h-4094' class="member">tagName</tt></b></dt> <dd> The element type name. In a namespace-using document it may have colons in it. The value is a string. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4095' class="method">getElementsByTagName</tt></b>(</nobr></td> <td><var>tagName</var>)</td></tr></table></dt> <dd> Same as equivalent method in the <tt class="class">Document</tt> class. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4096' class="method">getElementsByTagNameNS</tt></b>(</nobr></td> <td><var>tagName</var>)</td></tr></table></dt> <dd> Same as equivalent method in the <tt class="class">Document</tt> class. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4097' class="method">getAttribute</tt></b>(</nobr></td> <td><var>attname</var>)</td></tr></table></dt> <dd> Return an attribute value as a string. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4098' class="method">getAttributeNode</tt></b>(</nobr></td> <td><var>attrname</var>)</td></tr></table></dt> <dd> Return the <tt class="class">Attr</tt> node for the attribute named by <var>attrname</var>. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4099' class="method">getAttributeNS</tt></b>(</nobr></td> <td><var>namespaceURI, localName</var>)</td></tr></table></dt> <dd> Return an attribute value as a string, given a <var>namespaceURI</var> and <var>localName</var>. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4100' class="method">getAttributeNodeNS</tt></b>(</nobr></td> <td><var>namespaceURI, localName</var>)</td></tr></table></dt> <dd> Return an attribute value as a node, given a <var>namespaceURI</var> and <var>localName</var>. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4101' class="method">removeAttribute</tt></b>(</nobr></td> <td><var>attname</var>)</td></tr></table></dt> <dd> Remove an attribute by name. No exception is raised if there is no matching attribute. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4102' class="method">removeAttributeNode</tt></b>(</nobr></td> <td><var>oldAttr</var>)</td></tr></table></dt> <dd> 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> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4103' class="method">removeAttributeNS</tt></b>(</nobr></td> <td><var>namespaceURI, localName</var>)</td></tr></table></dt> <dd> 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> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4104' class="method">setAttribute</tt></b>(</nobr></td> <td><var>attname, value</var>)</td></tr></table></dt> <dd> Set an attribute value from a string. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4105' class="method">setAttributeNode</tt></b>(</nobr></td> <td><var>newAttr</var>)</td></tr></table></dt> <dd> Add a new attibute 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 raised. </dl> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4106' class="method">setAttributeNodeNS</tt></b>(</nobr></td> <td><var>newAttr</var>)</td></tr></table></dt> <dd> Add a new attibute 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> <P> <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> <td><nobr><b><tt id='l2h-4107' class="method">setAttributeNS</tt></b>(</nobr></td> <td><var>namespaceURI, qname, value</var>)</td></tr></table></dt> <dd> 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 different than above. </dl> <P> <DIV CLASS="navigation"> <div class='online-navigation'><hr /> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="13.6.2.5 Document Objects" 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" rel="parent" title="13.6.2 Objects in the" href="node565.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" 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" 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" rel="index" title="Index" href="genindex.html"><img src='../icons/index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <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="node565.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> </div> </div> <hr /> <span class="release-info">Release 2.3.4, documentation updated on May 20, 2004.</span> </DIV> <!--End of Navigation Panel--> <ADDRESS> See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. </ADDRESS> </BODY> </HTML>