<!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.Node
</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.Element.html#_top_">Previous</a>  <a href="w3c.xmlOnline.tree.PI.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class w3c.xmlOnline.tree.Node
</h1>
<pre>
java.lang.Object
   |
   +----w3c.xmlOnline.tree.Node
</pre>
<hr>
<dl>
  <dt> public class <b>Node</b>
  <dt> extends Object
</dl>
Base type for all nodes in an XML tree.
<p>
<dl>
  <dt> <b>Version:</b>
  <dd> $Id: w3c.xmlOnline.tree.Node.html,v 1.7 1997/06/09 22:26:00 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="#parent"><b>parent</b></a>
  <dd>  The parent in the XML tree, or null

  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#seqno"><b>seqno</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="#Node(w3c.xmlOnline.tree.Node, int)"><b>Node</b></a>(Node, int)
  <dd>  Create a new Node with the given parent
 
</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="#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="#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="#findXPTR(java.lang.String, int)"><b>findXPTR</b></a>(String, int)
  <dd>  Return element pointed to by a TEI xptr.
  <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 below this node

  <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="#parent()"><b>parent</b></a>()
  <dd>  Return the parent of this node.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#protect(java.lang.String)"><b>protect</b></a>(String)
  <dd>  Encode a string with certain characters replaced by
 numerical character entities.
  <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)"><b>replaceBy</b></a>(Node)
  <dd>  Replace the current node by the given 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 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="#replaceBy(w3c.xmlOnline.tree.Node[])"><b>replaceBy</b></a>(Node[])
  <dd>  Replace the current node by the given array of nodes.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#root()"><b>root</b></a>()
  <dd>  Return the root of the tree.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#seqno()"><b>seqno</b></a>()
  <dd>  Return the sequence number of this node in the tree.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setParent(w3c.xmlOnline.tree.Node)"><b>setParent</b></a>(Node)
  <dd>  Set the parent of this node.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="parent"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>parent</b>
<pre>
 protected <a href="#_top_">Node</a> parent
</pre>
<dl>
  <dd> The parent in the XML tree, or null<p>
</dl>
<a name="seqno"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>seqno</b>
<pre>
 protected int seqno
</pre>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Node"></a>
<a name="Node(w3c.xmlOnline.tree.Node, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Node</b>
<pre>
 public Node(<a href="#_top_">Node</a> parent,
             int nr)
</pre>
<dl>
  <dd> Create a new Node with the given parent
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> parent - the parent of the node
    <dd> nr - the sequence number of the node in the tree
    <dt> <b>Returns:</b>
    <dd> the new Node
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="setParent(w3c.xmlOnline.tree.Node)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setParent"><b>setParent</b></a>
<pre>
 public <a href="#_top_">Node</a> setParent(<a href="#_top_">Node</a> node)
</pre>
<dl>
  <dd> Set the parent of this node.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> node - the node to use as parent
    <dt> <b>Returns:</b>
    <dd> self
  </dl></dd>
</dl>
<a name="parent()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="parent"><b>parent</b></a>
<pre>
 public <a href="#_top_">Node</a> parent()
</pre>
<dl>
  <dd> Return the parent of this node.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the parent node, or null
  </dl></dd>
</dl>
<a name="replaceBy(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>
 public <a href="#_top_">Node</a> replaceBy(<a href="#_top_">Node</a> nodes[])
</pre>
<dl>
  <dd> Replace the current node by the given array of nodes. This is
 done by asking the parent to insert the array in its list of
 children, and then setting the parent of this node to null, so
 that it isn't a part of the tree anymore.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> nodes - an array of nodes to replace this node in the tree
  </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="#_top_">Node</a> replaceBy(<a href="#_top_">Node</a> child,
                          <a href="#_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
  </dl></dd>
</dl>
<a name="replaceBy(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>
 public <a href="#_top_">Node</a> replaceBy(<a href="#_top_">Node</a> node)
</pre>
<dl>
  <dd> Replace the current node by the given node. This is
 done by asking the parent to insert the node in its list of
 children, and then setting the parent of this node to null, so
 that it isn't a part of the tree anymore.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> nodes - an array of nodes to replace this node in the tree
  </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="#_top_">Node</a> replaceBy(<a href="#_top_">Node</a> child,
                          <a href="#_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
  </dl></dd>
</dl>
<a name="seqno()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="seqno"><b>seqno</b></a>
<pre>
 public int seqno()
</pre>
<dl>
  <dd> Return the sequence number of this node in the tree.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the sequence number of this node in the tree.
  </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
  </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 below this node
<p>
</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
  </dl></dd>
</dl>
<a name="root()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="root"><b>root</b></a>
<pre>
 public <a href="#_top_">Node</a> root()
</pre>
<dl>
  <dd> Return the root of the tree. Recursively ask for
 the parent until there is none anymore.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the root of the tree of this node
  </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="#_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
  </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="#_top_">Node</a> addID(String ID,
                      <a href="w3c.xmlOnline.tree.Element.html#_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
  </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="#_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
  </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
  </dl></dd>
</dl>
<a name="findXPTR(java.lang.String, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="findXPTR"><b>findXPTR</b></a>
<pre>
 public <a href="#_top_">Node</a> findXPTR(String xptr,
                      int n)
</pre>
<dl>
  <dd> Return element pointed to by a TEI xptr.  The passed string is
 interpreted as a TEI xptr and the instructions in it are followed
 to find the element it points to. Only the first part is
 interpreted, the rest of the string is passed on recursively to
 the element addressed by the first part. The extra argument
 indicates which of the addressed elements (in case there is more
 than one) should be returned.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> xptr - the TEI xptr
    <dd> n - which of the set of addresses element is returned (n>=0)
    <dt> <b>Returns:</b>
    <dd> the first addressed element
  </dl></dd>
</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.
 Subclasses must overide this method.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> out - the PrintStream to write on
  </dl></dd>
</dl>
<a name="protect(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="protect"><b>protect</b></a>
<pre>
 public String protect(String s)
</pre>
<dl>
  <dd> Encode a string with certain characters replaced by
 numerical character entities.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> s - string to encode
    <dt> <b>Returns:</b>
    <dd> the encoded string
  </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.Element.html#_top_">Previous</a>  <a href="w3c.xmlOnline.tree.PI.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
