I have an XML file begining like this:
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
<DataSources>
When I run following code:
byte[] fileContent = //gets bytes
string stringContent = Encoding.UTF8.GetString(fileContent);
XDocument xml = XDocument.Parse(stringContent);
I get following XmlException:
Data at the root level is invalid. Line 1, position 1.
Cutting out the version and encoding node fixes the problem. Why? How to process this xml correctly?