How to use DOM Clone Node in XML
Posted in XML | DTD July 09, 2012
This article describe about DOM clone node in XML.
XML DOM Clone Nodes
DOM cloneNode creates the clone node. Which is accurate replica of this node, but it has the some exception that it can't have a parent node.
Copy a Node
For copy of specific node cloneNode() method creates, cloneNode() method has a parameter which has the two value (true or false). This parameter show that if cloned node should contain all attributes and child nodes of it's original node.
//Output all titles
Note: This part of code specified the first <book> and appends it to the root node of the document.
Output of this program
XQuery quick Start
- First "book.xml" load into the xmlDoc usnig the loadXMLDoc() method.
- Then the node copy
- By using the cloneNode method copy the node into "newNode"
- The root node of XML append the new node of XML document.
- The ouput all titles in the document
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here