我需要使用 VB6 更新 bkp_path 的属性值。
XML 文件
<ServerDetails>
<Param src_path = "D:\Shapes\Rectangle" bkp_path = "D:\Colors\Red"/>
</ServerDetails>
我可以使用从 XML 文件中读取值
VB6 代码
Dim doc As New MSXML2.DOMDocument
Set doc = New MSXML2.DOMDocument
Dim success As Boolean
'Load Config.xml
success = doc.Load("\Config\config.xml")
If success = False Then
MsgBox ("Unable to locate the configuration file")
Exit Function
Else
Dim nodeList As MSXML2.IXMLDOMNodeList
Set nodeList = doc.selectNodes("/ServerDetails/Param")
If Not nodeList Is Nothing Then
Dim node As MSXML2.IXMLDOMNode
For Each node In nodeList
srcpath = node.selectSingleNode("@src_path").Text
bkpPath = node.selectSingleNode("@bkp_path").Text
Next node
End If
End If
但无法弄清楚如何更新属性值。