My mistake, it does work by reference. Sorry!

John Byrne wrote:
> Hi,
>
> I have a slight problem adding nodes to a document with DOM4J:
>
> I need to select the parent node with a, XPath statement, and add nodes 
> to it.
>
> But it seems that nodes I select are copies of the nodes, rather than 
> references to them.
>
> In other words, if I use this line...:
>
>     Node parentNode = document.selectSingleNode(xxxx)
>
> ...then I add to 'parentNode' like this...
>
>     parentNode.add(some_new_node)
>
> ...then the original 'document' (from which I selected 'parentNode') 
> doesn't have the new node in it!
>
> Is there any easy way to achieve this? Or am I going it about it the 
> wrong way altogether?
>
> Thanks in advance!
>
> John B.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> dom4j-user mailing list
> dom4j-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to