7,762
社区成员
发帖
与我相关
我的任务
分享
Private Function getXML() As String
Dim xml As New DOMDocument
xml.loadXML "<?xml version=""1.0"" encoding=""GB2312"" ?>" & _
"<root>" & _
"<design>" & _
"<r>5 </r>" & _
"<shape>circle </shape>" & _
"</design>" & _
"<design>" & _
"<r>10 </r>" & _
"<shape>triangle </shape>" & _
"</design>" & _
"</root>"
Dim designNodes As IXMLDOMNodeList
Set designNodes = xml.selectNodes("/root/design")
Dim aNode As IXMLDOMNode
For Each aNode In designNodes
If aNode.selectSingleNode("r").Text = "10" Then
MsgBox aNode.xml '这里的aNode就是你想要的结点
Exit Function
End If
Next
End Function