I have a dom4j program that adds cloned nodes into a Document.
I'm noticing that when it comes time to process the cloned node (this can
include cloning the clone) (I use a recursive treewalk) that the clone is
always missing a Document, and frequently a Parent. This only happens when I
process a clone.
*Roughly*, the scheme is:
private void processNode(Node node){
clone = node.clone(); //createCopy has the same effect
try{
findYourParentXPath.selectSingleNode(node).add(clone);
}catch(NullPointerException npe){
node.getParent().add(clone);
}
treewalk(clone);
}
with treewalk eventually calling back into processNode.
Dumping the Document I get the mis-processed clones, although in the wrong
location (the search for their parent fails due to the null Document).
Is this out-of-scope for dom4j or am I missing some step? It's almost like the
tree needs to be re-read before processing the clone (not an option in this
case).
If someone has an example of cloning a clone and inserting it into the Document
I'd appreciate a look.
Thanks-- Mike
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user