shahin
Active Member
I've written a script to parse some xml content using vba in combination with xpath. The first script I've pasted below with a site link in it is just working like magic. However, applying the same logic in another site I neither get any data nor any error. As it is my first time to work with any xml webpage, I can't understand any mistake I'm making. Thanks in advance for any input.
Here is the first script: (the working one)
The second script which is not working at all:
Any data from this site will do.
Here is the first script: (the working one)
Code:
Sub XML_Parsing()
Dim http As New XMLHTTP60
Dim xmldoc As Object, post As Object
With http
.Open "GET", "http://wservice.viabicing.cat/v1/getstations.php?v=1", False
.send
Set xmldoc = .responseXML
xmldoc.LoadXML .responseXML.XML
End With
For Each post In xmldoc.SelectNodes("//station")
x = x + 1: Cells(x, 1) = post.SelectNodes(".//lat")(0).Text
Cells(x, 2) = post.SelectNodes(".//long")(0).Text
Next post
End Sub
The second script which is not working at all:
Code:
Sub XML_Parsing()
Dim http As New XMLHTTP60
Dim xmldoc As Object, post As Object
With http
.Open "GET", "https://drinkup.london/sitemap.xml", False
.send
Set xmldoc = .responseXML
xmldoc.LoadXML .responseXML.XML
End With
For Each post In xmldoc.SelectNodes("//url/loc")
x = x + 1: Cells(x, 1) = post.Text
Next post
End Sub
Any data from this site will do.