I am trying to deserialize xml by using the followng code
var reader = new StringReader(uri);
var serializer = new XmlSerializer(typeof(livescore));
var livescores = (livescore)serializer.Deserialize(reader);
where as 'fileToRead' containing a url from where to load xml. But when it tires to deserialize, throws an error
Data at the root level is invalid. Line 1, position 1
I looked a no of post related to this issue, but none of the trick working for me. Any suggestion please?
If I copy the response into a file and read using StreamReader
instead of StringReader
, it works fine. Not sure, what changes I need to make