[jdom-interest] insertChild in Element

Trebor A. Rude trebor at bwn.net
Thu Aug 31 06:05:41 PDT 2000


On Thu, 31 Aug 2000, philip.nelson at omniresources.com wrote:

>> The line:
>> 	element.getChildren().add(newElement, 3);
>> makes perfect sense. But the alternative line:
>> 	element.add(newElement, 3);
>> just doesn't feel right.
>
>yes, an add method looks more like it's at the same level, a sibling.

	Good point, if you're going to add a child, "child" should be somewhere 
in the method call to do that. How would you feel if the function were 
like this:

element.addChild(3, newElement);

Of course, given the current API in the CVS, it might be named 
"addContent" instead, which isn't quite as clear, but shouldn't be a major 
stumbling block.

-- 
Trebor A. Rude
trebor at bwn.net
Registered Linux User #89308
http://counter.li.org/



More information about the jdom-interest mailing list