I have this code to load the xml (to a List) and it works fine:
public MainPage()
{
this.InitializeComponent();
string XMLFilePath = Path.Combine(Package.Current.InstalledLocation.Path, "something.xml");
XDocument loadedData = XDocument.Load(XMLFilePath);
}
what if I want to call the xml from my server!?
This is the last try:
using System.Net.Http;
using System.Runtime.Serialization.Json;
...
private string jsonString;
public MainPage()
{
this.InitializeComponent();
loadData();
//string XMLFilePath = Path.Combine(Package.Current.InstalledLocation.Path, "something.xml");
XDocument loadedData = XDocument.Load(jsonString);
...
private async void loadData()
{
var httpClient = new HttpClient();
HttpResponseMessage response = await httpClient.GetAsync(new Uri("http://domain.com/something.xml"));
jsonString = await response.Content.ReadAsStringAsync();
}
this is the error:
An exception of type 'System.ArgumentNullException' occurred in System.Xml.ReaderWriter.dll but was not handled in user code
Any help would be great.
Thanks.