vb+xml,修改节点值请教。
xml文件内容:
<job>
<inputs>
<input >
<fileName> C:\test.mpg </fileName>
</input>
</inputs>
<outputs>
<fileOutput>
<fileName> C:\test.mpg </fileName>
</fileOutput>
</outputs>
<job>
代码如下:
Dim xml_document As DOMDocument
Dim values_node As IXMLDOMNode
Dim values_node2 As IXMLDOMNode
' Load the document
Set xml_document = New DOMDocument
xml_document.Load xmlFileName
If xml_document.documentElement Is Nothing Then
Exit Sub
End If
Set values_node = xml_document.selectSingleNode( ".// " & "job/inputs/input/filename ")
values_node.Text = encodeFileName
Set values_node2 = xml_document.selectSingleNode( ".// " & "job/outputs/fileOutput/fileName ")
'values_node.Attributes.getNamedItem( "fileName ").Text = exportFileName
values_node2.Text = exportFileName
xml_document.save xmlFileName
Set xml_document = Nothing
Set values_node = Nothing
第一次写vb,请大家多多指教,谢谢。
[解决办法]
问题是什么?