Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15589

Download XML file

$
0
0
Hello,

Problem: I would like to download a XML file with exchange rates so I can further upload it into a SQL Server table.

For the XML download, this is the code I have so far:
Dim webRequest As WebRequest = WebRequest.Create("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml")
Dim webResponse As WebResponse = webRequest.GetResponse
Dim webStream As Stream = webResponse.GetResponseStream

Dim reader As New StreamReader(webStream)
reader.ReadToEnd()

Dim xmlDoc As New XmlDocument
xmlDoc.Load(webStream)

I do see the data in webStream, but how can I save it to a XML file? I thought xmlDoc.Save would do the trick, but it doesn't.

Thank you in advance

Viewing all articles
Browse latest Browse all 15589

Trending Articles