I'm familiar with using the MSXML2 library for reading xml files. But is there an easy way of editing a particular node. Say I have the following line of code that selects a dataroot
element that has the attribute generated
:
Dim oDoc as MSXML2.DOMDocument
Dim oNode as MSXML2.IXMLDOMNode
Set oDoc = ... //open xml file here//
Set oNode = oDoc.selectSingleNode("/root/dataroot/[@generated]")
I want to be able to remove the generated
attribute from the selected node and save the change back to the original file.
To remove an attribute from an node:
oNode.removeAttribute("generated");
To save the changes:
oDoc.save("changed.xml")