[jdom-interest] "Cloning" Problem

Wang K H khong.hai.wang at gridnode.com
Thu Nov 16 00:45:26 PST 2000


I just started using JDOM and I am facing a problem with the clone() method of Element.

My code is as follows :

      Element tempNode = (Element)currentNode.clone();
      System.out.println("Parent " + currentNode.getParent().getName());
      while(tempNode.getParent() != null)
        currentNodeHName = tempNode.getName() + "/" +  currentNodeHName;
        tempNode = tempNode.getParent();
        System.out.println("Path " + currentNodeHName);

The first print statement shows the name of the parent. The second print statement did not even get printed. This means that after the cloning, the parent is lost, that's why the while loop is not entered. Is this a known problem or there is something wrong with my code.

Thanks a lot for any help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20001116/73dd34b9/attachment.htm

More information about the jdom-interest mailing list