David,
dom4j behaved correctly, since you are requesting wrong element from the context of your XPath.
You are retrieving element in this line of the code:
> Node node = document.selectSingleNode("/root/first");
Then you create a copy of that node.
> elem = elem.createCopy();
At that poi
Hi;
Element.createCopy() is not handling XPath as I
would expect - it won't accept a "/base" as an argument - it requires
"./base"
The code:
public class Dom4jTest {
public static void main(String[] args) throws
DocumentException {
System.out.println("starting");
Document doc