下面是一个可以判断xml 节点是否存在的函数,如下,仅供参考:
Function xmlElementNodeIsExist(ByVal xmlpath As String, ByVal strElementNodeName As String) As Boolean
Using reader As XmlReader = XmlReader.Create(xmlpath)
While reader.Read()
If reader.Name = strElementNodeName And reader.NodeType = XmlNodeType.Element Then
Return True
End If
End While
End Using
Return False
End Function