-1

I would like to retrieve this data inside of a class in c# based on a URL address "http://sporing.bring.no/sporing.xml?q=TESTPACKAGE-AT-PICKUPPOINT".

Unfortunately, you cannot use "XDocument xml = XDocument.Load("");" to retrieve the data because the url address is not a xml file.

What sourcecode in C# do I need in order to retrieve the data of the xml based on the URL address "http://sporing.bring.no/sporing.xml?q=TESTPACKAGE-AT-PICKUPPOINT"?

Thanks!

3
  • you have to download it using a webclient. Commented Jun 5, 2015 at 22:02
  • the data because the url address is not a xml file Huh? That is an XML file. That works fine. Commented Jun 5, 2015 at 22:03
  • Just use WebClient.DownloadFile to download it into a string, then use XDocument.Parse() to load it from the string. Commented Jun 5, 2015 at 22:04

1 Answer 1

0
XDocument xml = XDocument.Parse(new WebClient().DownloadString("http://sporing.bring.no/sporing.xml?q=TESTPACKAGE-AT-PICKUPPOINT"));

This will probably solve your problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.