When I try to load an XML file, I'm getting the error: "Data at the root level is invalid. Line 1, position 1.". Here's the relevant code:
string line;
StreamReader file = new StreamReader(filepath);
while ((line = file.ReadLine()) != null)
{
XDocument doc = XDocument.Load("http://api.discogs.com/release/" + line);
//do processing
}
The way it works, is that I open a file in the streamreader which contains a list of release numbers, for example:
367315
123456
192837
Then I want to append those one by one to the rest of the url, so that I can process many XML files at once. However, upon loading the XML I get the mentioned error. I've no idea what causes this. Is it well-formedness or the encoding? I hope anyone can help me out!