XML节点值VB.net

时间:2014-06-19 14:29:37

标签: xml vb.net xmlnode

我试图从节点内部提取一个值,但似乎无法让它工作。我想从name =" Container.DeviceId"

获取value =
<coreProperties>    
    <coreProperty name="Common.ApplicationHome" value="1" />
    <coreProperty name="Common.InstallationHome" value="2" />
    <coreProperty name="Container.DeviceId" value="3"/>
    <coreProperty name="Service.DeviceID" value="4/>
    <coreProperty name="Service.DeviceType" value="5" />
    <coreProperty name="Service.LocationID" value="6" />
</coreProperties>

这是我到目前为止所拥有的

doc.Load(file1)
Dim root As XmlNode = doc.DocumentElement
Dim nodeDeviceId As XmlNode = root.SelectSingleNode("/coreProperties/coreProperty[@name='Container.DeviceId']")
Dim deviceID As String = nodeDeviceId.Attributes.ItemOf("value").InnerText

0 个答案:

没有答案