Thanked first!
CodePudding user response:
References to XML, loading XML documents, selectsinglenode find node, the setattribute set property valuesCodePudding user response:
Dim values_element As IXMLDOMElementDim objNode as IXMLDOMNode
The Set objNode=xmldoc. SelectSingleNode (" Recipe ")
Set values_element=objNode. SetAttribute "Path", "D: \ file XML"
Thus the & lt; The Recipe Path="d: \ test XML" NumberOfTests="4" & gt; The Path attribute is set to "D: \ file XML"
Ps: there is a requirement for path selectSingleNode parameter is,
CodePudding user response:
Sub ChangeXML ()
' '...
The Set xmlNode=xmlDoc. SelectSingleNode (" Recipe//RecipeInfo ")
With xmlNode
"SetAttribute MachineId", "aaa"
The setAttribute "DeviceId", "BBB"
The setAttribute "StepId", "CCC"
End With
"'...
End Sub
CodePudding user response:
Less a:Set xmlNode=xmlDoc. SelectSingleNode (" Recipe ")
XmlNode. SetAttribute "Path", "d: \ 123. XML"