Comments and questions on text node interface

Dear all!

I have comments and question regarding the following attributes/methods 
of the text node interface:

1. wholeText attribute:

What is the expected use case of this attribute? Shouldn't this 
functionality moved to the parent, because it is quite similar, to the 
textContent attribute of the node interface? If this functionality is 
really needed then I propose to have a method on node:

/**
 * Collects the text content of all logically-adjacent text nodes of the 
specified text node.
 */
public String getWholeText(int anIndex);   // alternatively: 
getWholeText(Text aTextNode)

2. replaceWholeText method

This method has a lot of tree-processing logic that should not be 
executed by a child node on its parent node. I would prefer the parent 
node to have control over the process. Therefore I propose a method on 
the node interface:

/**
 * Replaces the logically-adjactent text nodes always by a NEW text node.
 */
public Text replaceWholeText(int anIndex); // alternatively: 
replaceWholeText(Text aTextNode);

3. splitText method

To be consistent I would also move this method to the node interface too.

In general I think that the DOM core should not contain too much 
special-purpose functionalites like these once. In addition I assume 
that this attribute and these methods are meant for editing. Therefore 
they should be moved from the DOM core to the NodeEditAS interface.

--Stefan

Received on Wednesday, 13 March 2002 16:56:09 UTC