Download XML File

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You may be able to adapt this code (ignoring a lot of the text manipulation and writing to worksheet cells):
http://scriptorium.serve-it.nl/view.php?sid=40

It uses a httprequest object which is very fast (ajax-ish) and will get the data as a string for you - you can write that to a file as your xml - you may need to parse out the comments at the top if they are also returned.
 
Upvote 0
Andy

What data are you trying to access here?

I'm pretty sure there might be some other way to do it without downloading an XML file.

As far as I know an XML file on it's own doesn't really mean much without other associated files.
 
Upvote 0
John

Don't you need other files to 'properly' parse an XML file?

Isn't there some sort of 'schema' involved?
 
Upvote 0
I don't think you always need an XML schema. You can load and parse it directly, like this:
Code:
'Requires reference to Microsoft XML, v6.0

Sub Loop_XML()

    Dim XMLDoc As DOMDocument
    Dim XMLNodes As IXMLDOMNodeList
    Dim XMLNode As IXMLDOMNode
    Dim XMLAttrib As IXMLDOMAttribute
    
    Set XMLDoc = New DOMDocument
    XMLDoc.async = False
    XMLDoc.Load ("http://pricefeeds.williamhill.com/oxipubserver?template=getClasses")
    
    Debug.Print XMLDoc.XML
    
    Set XMLNodes = XMLDoc.SelectNodes("/oxip/response/class")

    For Each XMLNode In XMLNodes
        Debug.Print XMLNode.XML
        For Each XMLAttrib In XMLNode.Attributes
            Debug.Print XMLAttrib.Name, XMLAttrib.Value
        Next
    Next

End Sub
 
Upvote 0
John

Just tried that code, and the output in the Immediate window looks like it still needs some sort of parsing.

Wouldn't that need some sort of associated 'schema' or 'definition' file?

Sorry for all the questions.:)
 
Upvote 0

Forum statistics

Threads
1,214,574
Messages
6,120,329
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top