To read nodes of a certain tagname of an xml file,it's easy to access:
Sub Test() Dim http As Object, nod, nod2 Set http = CreateObject("Microsoft.XMLHTTP") http.Open "get", "http://www.w3schools.com/xml/simple.xml", False http.send For Each nod In http.responseXML.getElementsByTagName("food") For Each nod2 In nod.childNodes Debug.Print Left(StrConv(nod2.nodeName, vbProperCase) & Space(15), 15) & nod2.Text Next Debug.Print Next End Sub
本文介绍了一种使用VBA代码从指定URL获取XML文件并读取特定标签内容的方法。通过示例展示了如何遍历XML节点并打印所需数据。
725

被折叠的 条评论
为什么被折叠?



