- From: Laurent ROUVET <rouvet@cnam.fr>
- Date: Mon, 29 Dec 1997 10:09:58 +0100
- To: www-dom@w3.org, Alexandre Rafalovitch <arafalov@socs.uts.EDU.AU>
> Date: Sun, 26 Oct 1997 14:56:23 +1100 (EST) > From: Alexandre Rafalovitch <arafalov@socs.uts.EDU.AU> > To: www-dom@w3.org > Message-ID: <Pine.SOL.3.95.971026144012.29998A-100000@charlie> > Subject: Node.insert(idx, child) is not sufficient for building DOM. > > Specification for Node is missing appendChild call, I believe. > If you want to add a child at the end of the current children of the node, > there are two ways to do it: > 1) node.getChildren().append(newChild) > 2) node.insert(100000, newChild) > > The problem in first case is how and when to set the parent up. It is You can add a method setParent(Node parent) at class Node and class NodeList. public class NodeList implement w3c.dom.NodeList { private Node parent; protected void setParent(Node parent) {this.parent = parent; } public void append(Node child) { if (child != null) { child.setParent(parent); list.add(child); } } For your second PB, you can use Integer.MAX_VALUE Look http://www.mygale.org/01/rouvet/en/dom I did a simple implementation of the Java DOM interfaces to test. Laurent.
Received on Monday, 29 December 1997 17:28:34 UTC