<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Mon Jun 09 23:45:36 GMT+03:30 1997 -->
<title>
  Class w3c.xmlOnline.tree.Element
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-w3c.xmlOnline.tree.html">This Package</a>  <a href="w3c.xmlOnline.tree.Data.html#_top_">Previous</a>  <a href="w3c.xmlOnline.tree.Node.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class w3c.xmlOnline.tree.Element
</h1>
<pre>
java.lang.Object
   |
   +----<a href="w3c.xmlOnline.tree.Node.html#_top_">w3c.xmlOnline.tree.Node</a>
           |
           +----w3c.xmlOnline.tree.Element
</pre>
<hr>
<dl>
  <dt> public class <b>Element</b>
  <dt> extends <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
</dl>
Class that holds an element node in the XML tree. It has a
 dictionary of attributes and values, and a list of children.
 The children and attributes can be other
 elements, processing instructions,
 comments or text nodes. By convention, all element names and
 attribute names are stored in lowercase (but nothing in this
 class checks or enforces that).
<p>
<dl>
  <dt> <b>Version:</b>
  <dd> $Id: w3c.xmlOnline.tree.Element.html,v 1.7 1997/06/09 22:25:51 bbos Exp $
  <dt> <b>Author:</b>
  <dd> Bert Bos
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#attrs"><b>attrs</b></a>
  <dd> 
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#children"><b>children</b></a>
  <dd> 
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#name"><b>name</b></a>
  <dd> 
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Element(w3c.xmlOnline.tree.Node, java.lang.String, int)"><b>Element</b></a>(Node, String, int)
  <dd>  Create a new XML Element node with the given name.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addAttribute(java.lang.String, java.lang.String)"><b>addAttribute</b></a>(String, String)
  <dd>  Add (or change) an attribute/value pair to this element.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addChild(w3c.xmlOnline.tree.Node)"><b>addChild</b></a>(Node)
  <dd>  Add a child node at the end of the list of children
 of this element.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#addID(java.lang.String, w3c.xmlOnline.tree.Element)"><b>addID</b></a>(String, Element)
  <dd>  Add the caller to the idTable of the root of this tree,
 with the given ID as key.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#attributes()"><b>attributes</b></a>()
  <dd>  Return an Enumeration of the attribute names of this element.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#attributeValue(java.lang.String)"><b>attributeValue</b></a>(String)
  <dd>  Return the value of the attribute with name `name', or
 null if the attribute doesn't exist.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#children()"><b>children</b></a>()
  <dd>  Return an Enumeration of the child nodes of this element.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#data()"><b>data</b></a>()
  <dd>  Return the concatenation of all Data nodes inside the
 element.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#dumpTree(java.io.PrintStream)"><b>dumpTree</b></a>(PrintStream)
  <dd>  A method to write out the content of
 the node in correct XML synyax.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#findID(java.lang.String)"><b>findID</b></a>(String)
  <dd>  Return the element with a certain ID in the tree
 around this element.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getChild(int)"><b>getChild</b></a>(int)
  <dd>  Get n'th child (n >= 1).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getNodeByNumber(int)"><b>getNodeByNumber</b></a>(int)
  <dd>  Get the node with seqno n from the subtree below this node.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ids()"><b>ids</b></a>()
  <dd>  Return an enumeration of all IDs in the tree.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#lastSeqno()"><b>lastSeqno</b></a>()
  <dd>  Return the highest seqno in the subtree of this node.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#name()"><b>name</b></a>()
  <dd>  Return the name of this element, or null.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nrChildren()"><b>nrChildren</b></a>()
  <dd>  Return the number of children.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#nrNodes()"><b>nrNodes</b></a>()
  <dd>  Return the number of nodes in the subtree below this node
 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#renumber(int[])"><b>renumber</b></a>(int[])
  <dd>  Renumber the nodes.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#replaceBy(w3c.xmlOnline.tree.Node, w3c.xmlOnline.tree.Node)"><b>replaceBy</b></a>(Node, Node)
  <dd>  Replace a child node by a different node.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#replaceBy(w3c.xmlOnline.tree.Node, w3c.xmlOnline.tree.Node[])"><b>replaceBy</b></a>(Node, Node[])
  <dd>  Replace a child node by a list of different nodes.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setName(java.lang.String)"><b>setName</b></a>(String)
  <dd>  Set the name of the element
 
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="name"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>name</b>
<pre>
 protected String name
</pre>
<a name="attrs"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>attrs</b>
<pre>
 protected Hashtable attrs
</pre>
<a name="children"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>children</b>
<pre>
 protected Vector children
</pre>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Element"></a>
<a name="Element(w3c.xmlOnline.tree.Node, java.lang.String, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Element</b>
<pre>
 public Element(<a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> parent,
                String name,
                int nr)
</pre>
<dl>
  <dd> Create a new XML Element node with the given name.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> parent - the parent of the node
    <dd> name - the name of the new element node
    <dd> nr - the sequence number of the node in the tree
    <dt> <b>Returns:</b>
    <dd> the new Element node
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="setName(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setName"><b>setName</b></a>
<pre>
 public <a href="#_top_">Element</a> setName(String name)
</pre>
<dl>
  <dd> Set the name of the element
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> root - the name of the start element
    <dt> <b>Returns:</b>
    <dd> the new Root node
  </dl></dd>
</dl>
<a name="name()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="name"><b>name</b></a>
<pre>
 public String name()
</pre>
<dl>
  <dd> Return the name of this element, or null.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the name of this element, or null
  </dl></dd>
</dl>
<a name="addChild(w3c.xmlOnline.tree.Node)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addChild"><b>addChild</b></a>
<pre>
 public <a href="#_top_">Element</a> addChild(<a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> c)
</pre>
<dl>
  <dd> Add a child node at the end of the list of children
 of this element.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> c - the node to add
    <dt> <b>Returns:</b>
    <dd> this
  </dl></dd>
</dl>
<a name="children()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="children"><b>children</b></a>
<pre>
 public Enumeration children()
</pre>
<dl>
  <dd> Return an Enumeration of the child nodes of this element.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> an Enumeration of the child nodes of this element
    <dt> <b>See Also:</b>
    <dd> Enumeration
  </dl></dd>
</dl>
<a name="nrChildren()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nrChildren"><b>nrChildren</b></a>
<pre>
 public int nrChildren()
</pre>
<dl>
  <dd> Return the number of children.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the number of children
  </dl></dd>
</dl>
<a name="replaceBy(w3c.xmlOnline.tree.Node, w3c.xmlOnline.tree.Node[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="replaceBy"><b>replaceBy</b></a>
<pre>
 protected <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> replaceBy(<a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> child,
                          <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> nodes[])
</pre>
<dl>
  <dd> Replace a child node by a list of different nodes.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> child - the child node to replace
    <dd> nodes - the nodes that are to replace the child
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#replaceBy(w3c.xmlOnline.tree.Node, w3c.xmlOnline.tree.Node[])">replaceBy</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="replaceBy(w3c.xmlOnline.tree.Node, w3c.xmlOnline.tree.Node)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="replaceBy"><b>replaceBy</b></a>
<pre>
 protected <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> replaceBy(<a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> child,
                          <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> node)
</pre>
<dl>
  <dd> Replace a child node by a different node.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> child - the child node to replace
    <dd> node - the node that is to replace the child
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#replaceBy(w3c.xmlOnline.tree.Node, w3c.xmlOnline.tree.Node)">replaceBy</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="addAttribute(java.lang.String, java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addAttribute"><b>addAttribute</b></a>
<pre>
 public <a href="#_top_">Element</a> addAttribute(String name,
                             String value)
</pre>
<dl>
  <dd> Add (or change) an attribute/value pair to this element.
 If the attribute name is "ID", the element is added
 to the table of elements indexed on ID, that is kept
 by the root.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> name - the name of the attribute
    <dd> value - the value of the attribute
    <dt> <b>Returns:</b>
    <dd> this
  </dl></dd>
</dl>
<a name="attributes()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="attributes"><b>attributes</b></a>
<pre>
 public Enumeration attributes()
</pre>
<dl>
  <dd> Return an Enumeration of the attribute names of this element.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> an Enumeration of the attribute names
  </dl></dd>
</dl>
<a name="attributeValue(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="attributeValue"><b>attributeValue</b></a>
<pre>
 public String attributeValue(String name)
</pre>
<dl>
  <dd> Return the value of the attribute with name `name', or
 null if the attribute doesn't exist.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> name - the name of an attribute (lowercase)
    <dt> <b>Returns:</b>
    <dd> the value of the attribute, or null
  </dl></dd>
</dl>
<a name="getChild(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getChild"><b>getChild</b></a>
<pre>
 public <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> getChild(int n)
</pre>
<dl>
  <dd> Get n'th child (n >= 1).
 If n is too large, it returns null.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> n - the number of the child to return
    <dt> <b>Returns:</b>
    <dd> the child, or null
  </dl></dd>
</dl>
<a name="getNodeByNumber(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getNodeByNumber"><b>getNodeByNumber</b></a>
<pre>
 public <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> getNodeByNumber(int n)
</pre>
<dl>
  <dd> Get the node with seqno n from the subtree below this node.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> n - the seqno to look for
    <dt> <b>Returns:</b>
    <dd> the node with seqno n in the subtree, or null
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#getNodeByNumber(int)">getNodeByNumber</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="nrNodes()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="nrNodes"><b>nrNodes</b></a>
<pre>
 public int nrNodes()
</pre>
<dl>
  <dd> Return the number of nodes in the subtree below this node
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the number of nodes in the subtree below this node
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#nrNodes()">nrNodes</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="lastSeqno()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="lastSeqno"><b>lastSeqno</b></a>
<pre>
 public int lastSeqno()
</pre>
<dl>
  <dd> Return the highest seqno in the subtree of this node.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#lastSeqno()">lastSeqno</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="renumber(int[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="renumber"><b>renumber</b></a>
<pre>
 protected void renumber(int n_in_out[])
</pre>
<dl>
  <dd> Renumber the nodes.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> n - the starting number
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#renumber(int[])">renumber</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="addID(java.lang.String, w3c.xmlOnline.tree.Element)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="addID"><b>addID</b></a>
<pre>
 protected <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> addID(String ID,
                      <a href="#_top_">Element</a> elt)
</pre>
<dl>
  <dd> Add the caller to the idTable of the root of this tree,
 with the given ID as key.
 An element that has an attribute called "ID" will use
 this method to add itself to the idTable of its root
 element. This call percolates up the tree until it
 reaches a Root element.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> ID - the ID to use as key (value of ID attribute)
    <dd> elt - the element to add
    <dt> <b>Returns:</b>
    <dd> this
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#addID(java.lang.String, w3c.xmlOnline.tree.Element)">addID</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="findID(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="findID"><b>findID</b></a>
<pre>
 public <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a> findID(String ID)
</pre>
<dl>
  <dd> Return the element with a certain ID in the tree
 around this element. The request is passed up the
 tree to the Root, which will look up the ID in its
 hash table.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> ID - the ID to look for
    <dt> <b>Returns:</b>
    <dd> the element with that ID, or null
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#findID(java.lang.String)">findID</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="ids()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="ids"><b>ids</b></a>
<pre>
 public Enumeration ids()
</pre>
<dl>
  <dd> Return an enumeration of all IDs in the tree.
 If this Root is not the root of the tree,
 it will pass the request up to the real root.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> an enumeration of all IDs in the tree
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#ids()">ids</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<a name="data()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="data"><b>data</b></a>
<pre>
 public String data()
</pre>
<dl>
  <dd> Return the concatenation of all Data nodes inside the
 element.
<p>
</dl>
<a name="dumpTree(java.io.PrintStream)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="dumpTree"><b>dumpTree</b></a>
<pre>
 public void dumpTree(PrintStream out)
</pre>
<dl>
  <dd> A method to write out the content of
 the node in correct XML synyax.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> out - the PrintStream to write on
    <dt> <b>Overrides:</b>
    <dd> <a href="w3c.xmlOnline.tree.Node.html#dumpTree(java.io.PrintStream)">dumpTree</a> in class <a href="w3c.xmlOnline.tree.Node.html#_top_">Node</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-w3c.xmlOnline.tree.html">This Package</a>  <a href="w3c.xmlOnline.tree.Data.html#_top_">Previous</a>  <a href="w3c.xmlOnline.tree.Node.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
