- From: Werner Donne' <wdonne@ibm.net>
- Date: Tue, 20 Jan 1998 14:34:33 +0100
- To: www-dom@w3.org
Good day, I would like to present a few remarks regarding the working draft of 9 December 1997 of the DOM Core Level1 specification. There seem to be three ways to iterate over the children of a Node object. First there are functions in the Node interface itself like getFirstChild etc. The second way is using Node.getChildren and continuing with the NodeList interface which has the item and getLength functions. The NodeList.getEnumerator provides access to the third iteration fashion. Wouldn't it be simpler to just provide the function Node.getEnumerator and use the resulting interface? The function Node.getChildren returns null if there are no children. I think this should return an empty NodeList to avoid introducing a special case. A call to Node.getChildren is normally followed with a loop that drives the iteration. Such a loop is capable of iterating over all sets and thus also empty ones. The null introduces redundant control flow in the form of an extra test. There are two ways to modify the set of children of a Node. Again there are functions in the Node interface itself. The second way is by using the EditableNodeList interface. However, I can't seem to find any function in the Core specification that returns such a list, which leaves me to think a type check must be performed on the result of Node.getChildren. The latter is not a problem of course. I suggest to provide only an EditableNodeEnumerator interface that is derived from the NodeEnumerator interface. The fact that Node.NodeType is an enumeration of type constants defined by the Node interface can break code in the future. When types are added clients of the Node interface are affected. It would be better in my opinion that derivatives of Node provide a symbolic constant that is returned by their version of Node.getNodeType. You can of course leave it to the CORBA run-time type checking functions as is suggested for the EditableNodeList interface (I think). With kind regards, -- Werner Donne' Re BVBA Leuvenselaan 172 B-3300 Tienen tel: (+32) 16 810203 fax: (+32) 16 820826 E-mail: wdonne@ibm.net
Received on Tuesday, 20 January 1998 08:42:32 UTC