Can't add one node to another

Eremiaambum

New Member
I have two Nodes \[code\]node1\[/code\] and \[code\]nod2\[/code\] which have different parent documents, now I want to call\[code\]node1.appendChild(node2);\[/code\] function for this nodes but my application crashes, below you can see owner documents and XMLs of nodes.\[code\]Document document1 = node1.getOwnerDocument();Document document2 = node2.getOwnerDocument();\[/code\]Both nodes have different owner documents. \[code\]node1\[/code\] owner document described below\[code\]<?xml version="1.0" encoding="UTF-8"?><ClientGetOTPSeedMessage> <UserID>userID</UserID> <DeviceInfo/></ClientGetOTPSeedMessage>\[/code\]and \[code\]node2\[/code\] owner document is as follow:\[code\]<?xml version="1.0" encoding="UTF-8"?><Desc> <Desc1>First name</Desc1> <Desc2>Second name</Desc2></Desc>\[/code\]Now I want to get \[code\]</Desc>\[/code\] node from \[code\]document2\[/code\] and put it to \[code\]<DeviceInfo/>\[/code\] node in the \[code\]document1\[/code\] how I can do it. And I want to say that \[code\]node1\[/code\] and \[code\]node2\[/code\] keep the nodes which I want to add one to another, but when I write \[code\]node1.appendChild(node2); \[/code\]my application crashes, I guess the main reason is that they have different owner documents.
 
Back
Top