Code to get attribute values from an xml
Was facing a problem in finding the attributes in an xml file, Here is the code of how to solve that:
Hope this helps!
Const XMLDataFile = "C:\Test.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
Dim strAttribute
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
Dim strAttribute
Set nodes = xmlDoc.SelectNodes("/Path till the node where the attribute is present")
For i = 0 To(nodes.Length -1)
strAttribute= nodes(i).getAttribute("Attribute Name")
MsgBox "Node #" & (i + 1)& ": " & strAttribute
Next
For i = 0 To(nodes.Length -1)
strAttribute= nodes(i).getAttribute("Attribute Name")
MsgBox "Node #" & (i + 1)& ": " & strAttribute
Next
Hope this helps!
Awesome i just googled your blog and found the solution.Thanks a Ton!
ReplyDelete