i wanted to copy/append a child from one xml to another. "unfortunately", it also removes that child from the original xml. any idea on how to DUPLICATE it?
Parameters
deep
Boolean. A flag that indicates whether to recursively clone all nodes that are descendants of this node. If True, creates a clone of the complete tree below this node. If False, clones this node and its attributes only.
Return Value
An object. Returns the newly created clone node.
Example
The following Microsoft® Visual Basic® example clones a node, and then appends it as a child of the top-level node.
Dim xmlDoc As New Msxml2.DOMDocument40
Dim root As IXMLDOMElement
Dim currNode As IXMLDOMNode
Dim MyNewNode As IXMLDOMNode
xmlDoc.async = False
xmlDoc.resolveExternals = False
xmlDoc.Load ("books.xml"
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox("You have error " & myErr.reason)
Else
Set root = xmlDoc.documentElement
Set currNode = root.childNodes.Item(1)
Set MyNewNode = currNode.cloneNode(True)
root.appendChild MyNewNode
MsgBox xmlDoc.xml
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.