Download XML File

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,824
Office Version
  1. 2019
Platform
  1. Windows
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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,271
Office Version
  1. 365
Platform
  1. Windows
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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,271
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

John

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

Isn't there some sort of 'schema' involved?
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,714
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,271
Office Version
  1. 365
Platform
  1. Windows
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.:)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,519
Messages
5,625,278
Members
416,086
Latest member
CaptainGD

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
Top