I have xml in string var "xml"
<?xml version=""1.1"" encoding=""UTF - 8"" ?>
< insertCommand table=""Colors"">
<parameter name=""Color"">Red</parameter>
<parameter name=""Code"">#FF0000</parameter>
</insertCommand>
I try get XDocument.
using (var inputStream = new StringReader(xml))
{
//var doc = new XPathDocument(inputStream);// It`s a same result
var doc = XDocument.Load(inputStream); // the exception occurs
using (var outputStream = doc.CreateWriter())
{
....
}
}
System.Xml.XmlException. Not allowed version number 1.1.
Unless there is something specific to 1.1 in the XML you could read it as a string, change the version to 1.0, and then process it normally. You can do a web search to find out what the differences are.
In VB .Net this worked
FWIW - the xml you posted had some errors