Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / dom-node-objects.html
<!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.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-nodelist-objects.html" />
<link rel="prev" href="dom-implementation-objects.html" />
<link rel="parent" href="node652.html" />
<link rel="next" href="dom-nodelist-objects.html" />
<meta name='aesop' content='information' />
<title>13.6.2.2 Node Objects </title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml: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.1 DOMImplementation Objects"
href="dom-implementation-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.3 NodeList Objects"
href="dom-nodelist-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-implementation-objects.html">13.6.2.1 DOMImplementation 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-nodelist-objects.html">13.6.2.3 NodeList Objects</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H3><A NAME="SECTION0015622000000000000000"></A><A NAME="dom-node-objects"></A>
<BR>
13.6.2.2 Node Objects
</H3>
<P>
All of the components of an XML document are subclasses of
<tt class="class">Node</tt>.
<P>
<dl><dt><b><tt id='l2h-4363' xml:id='l2h-4363' class="member">nodeType</tt></b></dt>
<dd>
An integer representing the node type. Symbolic constants for the
types are on the <tt class="class">Node</tt> object:
<tt class="constant">ELEMENT_NODE</tt>, <tt class="constant">ATTRIBUTE_NODE</tt>,
<tt class="constant">TEXT_NODE</tt>, <tt class="constant">CDATA_SECTION_NODE</tt>,
<tt class="constant">ENTITY_NODE</tt>, <tt class="constant">PROCESSING_INSTRUCTION_NODE</tt>,
<tt class="constant">COMMENT_NODE</tt>, <tt class="constant">DOCUMENT_NODE</tt>,
<tt class="constant">DOCUMENT_TYPE_NODE</tt>, <tt class="constant">NOTATION_NODE</tt>.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4364' xml:id='l2h-4364' class="member">parentNode</tt></b></dt>
<dd>
The parent of the current node, or <code>None</code> for the document node.
The value is always a <tt class="class">Node</tt> object or <code>None</code>. For
<tt class="class">Element</tt> nodes, this will be the parent element, except for the
root element, in which case it will be the <tt class="class">Document</tt> object.
For <tt class="class">Attr</tt> nodes, this is always <code>None</code>.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4365' xml:id='l2h-4365' class="member">attributes</tt></b></dt>
<dd>
A <tt class="class">NamedNodeMap</tt> of attribute objects. Only elements have
actual values for this; others provide <code>None</code> for this attribute.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4366' xml:id='l2h-4366' class="member">previousSibling</tt></b></dt>
<dd>
The node that immediately precedes this one with the same parent. For
instance the element with an end-tag that comes just before the
<var>self</var> element's start-tag. Of course, XML documents are made
up of more than just elements so the previous sibling could be text, a
comment, or something else. If this node is the first child of the
parent, this attribute will be <code>None</code>.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4367' xml:id='l2h-4367' class="member">nextSibling</tt></b></dt>
<dd>
The node that immediately follows this one with the same parent. See
also <tt class="member">previousSibling</tt>. If this is the last child of the
parent, this attribute will be <code>None</code>.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4368' xml:id='l2h-4368' class="member">childNodes</tt></b></dt>
<dd>
A list of nodes contained within this node.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4369' xml:id='l2h-4369' class="member">firstChild</tt></b></dt>
<dd>
The first child of the node, if there are any, or <code>None</code>.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4370' xml:id='l2h-4370' class="member">lastChild</tt></b></dt>
<dd>
The last child of the node, if there are any, or <code>None</code>.
This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4371' xml:id='l2h-4371' class="member">localName</tt></b></dt>
<dd>
The part of the <tt class="member">tagName</tt> following the colon if there is one,
else the entire <tt class="member">tagName</tt>. The value is a string.
</dl>
<P>
<dl><dt><b><tt id='l2h-4372' xml:id='l2h-4372' class="member">prefix</tt></b></dt>
<dd>
The part of the <tt class="member">tagName</tt> preceding the colon if there is one,
else the empty string. The value is a string, or <code>None</code>
</dl>
<P>
<dl><dt><b><tt id='l2h-4373' xml:id='l2h-4373' class="member">namespaceURI</tt></b></dt>
<dd>
The namespace associated with the element name. This will be a
string or <code>None</code>. This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4374' xml:id='l2h-4374' class="member">nodeName</tt></b></dt>
<dd>
This has a different meaning for each node type; see the DOM
specification for details. You can always get the information you
would get here from another property such as the <tt class="member">tagName</tt>
property for elements or the <tt class="member">name</tt> property for attributes.
For all node types, the value of this attribute will be either a
string or <code>None</code>. This is a read-only attribute.
</dl>
<P>
<dl><dt><b><tt id='l2h-4375' xml:id='l2h-4375' class="member">nodeValue</tt></b></dt>
<dd>
This has a different meaning for each node type; see the DOM
specification for details. The situation is similar to that with
<tt class="member">nodeName</tt>. The value is a string or <code>None</code>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4376' xml:id='l2h-4376' class="method">hasAttributes</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Returns true if the node has any attributes.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4377' xml:id='l2h-4377' class="method">hasChildNodes</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Returns true if the node has any child nodes.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4378' xml:id='l2h-4378' class="method">isSameNode</tt></b>(</nobr></td>
<td><var>other</var>)</td></tr></table></dt>
<dd>
Returns true if <var>other</var> refers to the same node as this node.
This is especially useful for DOM implementations which use any sort
of proxy architecture (because more than one object can refer to the
same node).
<P>
<div class="note"><b class="label">Note:</b>
This is based on a proposed DOM Level&nbsp;3 API which is still in the
``working draft'' stage, but this particular interface appears
uncontroversial. Changes from the W3C will not necessarily affect
this method in the Python DOM interface (though any new W3C API for
this would also be supported).
</div>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4379' xml:id='l2h-4379' class="method">appendChild</tt></b>(</nobr></td>
<td><var>newChild</var>)</td></tr></table></dt>
<dd>
Add a new child node to this node at the end of the list of children,
returning <var>newChild</var>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4380' xml:id='l2h-4380' class="method">insertBefore</tt></b>(</nobr></td>
<td><var>newChild, refChild</var>)</td></tr></table></dt>
<dd>
Insert a new child node before an existing child. It must be the case
that <var>refChild</var> is a child of this node; if not,
<tt class="exception">ValueError</tt> is raised. <var>newChild</var> is returned. If
<var>refChild</var> is <code>None</code>, it inserts <var>newChild</var> at the end of
the children's list.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4381' xml:id='l2h-4381' class="method">removeChild</tt></b>(</nobr></td>
<td><var>oldChild</var>)</td></tr></table></dt>
<dd>
Remove a child node. <var>oldChild</var> must be a child of this node; if
not, <tt class="exception">ValueError</tt> is raised. <var>oldChild</var> is returned on
success. If <var>oldChild</var> will not be used further, its
<tt class="method">unlink()</tt> method should be called.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4382' xml:id='l2h-4382' class="method">replaceChild</tt></b>(</nobr></td>
<td><var>newChild, oldChild</var>)</td></tr></table></dt>
<dd>
Replace an existing node with a new node. It must be the case that
<var>oldChild</var> is a child of this node; if not,
<tt class="exception">ValueError</tt> is raised.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4383' xml:id='l2h-4383' class="method">normalize</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Join adjacent text nodes so that all stretches of text are stored as
single <tt class="class">Text</tt> instances. This simplifies processing text from a
DOM tree for many applications.
<span class="versionnote">New in version 2.1.</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-4384' xml:id='l2h-4384' class="method">cloneNode</tt></b>(</nobr></td>
<td><var>deep</var>)</td></tr></table></dt>
<dd>
Clone this node. Setting <var>deep</var> means to clone all child nodes as
well. This returns the clone.
</dl>
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="13.6.2.1 DOMImplementation Objects"
href="dom-implementation-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.3 NodeList Objects"
href="dom-nodelist-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-implementation-objects.html">13.6.2.1 DOMImplementation 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-nodelist-objects.html">13.6.2.3 NodeList Objects</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</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>