本来想写个更多点说明的例子。。。
这163的编辑器老是清理掉那些id=""之类的,让例子看起来会很奇怪,还是不写了罢。。。
好了。小说明一下, 如果你在使用dom4j时候出现了:
org.dom4j.IllegalAddException: The node "your node description..." could not be added to the element "yourNode" because: The Node already has an existing parent of "yourNode"
好了。那么你肯定是用的myelement.add(needAddElement);
那么稍微改一改myelement.add((Element)needAddElement.clone());
这样。就不会有问题了
这163的编辑器老是清理掉那些id=""之类的,让例子看起来会很奇怪,还是不写了罢。。。
好了。小说明一下, 如果你在使用dom4j时候出现了:
org.dom4j.IllegalAddException: The node "your node description..." could not be added to the element "yourNode" because: The Node already has an existing parent of "yourNode"
好了。那么你肯定是用的myelement.add(needAddElement);
那么稍微改一改myelement.add((Element)needAddElement.clone());
这样。就不会有问题了