W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1997

Re: Node.insert(idx, child) is not sufficient for

From: Laurent ROUVET <rouvet@cnam.fr>
Date: Mon, 29 Dec 1997 10:09:58 +0100
Message-ID: <34A768E6.E999B81@cnam.fr>
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

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) {

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.

Received on Monday, 29 December 1997 17:28:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:03 UTC