dom4j问题:请教setText(String s)和addText(String s)的区别?

除了add可以添加空外,还有什么其他方面的区别吗?比如性能啥的~

javadoc
[quote]setText(String text)
Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

addText(String text)
Adds a new Text node with the given text to this element.
[/quote]

实现
[code="java"]public Element addText(String text) {
Text node = getDocumentFactory().createText(text);

addNewNode(node);

return this;

}
[/code]

[code="java"]public void setText(String text)
{
List allContent = contentList();

if (allContent != null) {
  Iterator it = allContent.iterator();

  while (it.hasNext()) {
    Node node = (Node)it.next();

    switch (node.getNodeType())
    {
    case 3:
    case 4:
    case 5:
      it.remove();
    }

  }

}

addText(text);

}[/code]

如果是Element的话没什么区别
[url]http://blog.csdn.net/ibm_hoojo/article/details/6679266[/url]