reazione iniziale, solo per confermare che posso riprodurre questo:
using System;
using System.Xml.Linq;
class Test
{
static void Main(string[] args)
{
string xml = "<?xml version=\"1.1\" ?><root><sub /></root>";
XDocument doc = XDocument.Parse(xml);
Console.WriteLine(doc);
}
}
I risultati in questa eccezione:
Unhandled Exception: System.Xml.XmlException: Version number '1.1' is invalid. Line 1, position 16.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
at System.Xml.Linq.XDocument.Parse(String text)
at Test.Main(String[] args)
E 'ancora in mancanza come di .NET 4.6.
fonte
2009-05-26 20:22:03
Qual è l'eccezione? puoi pubblicare l'xml? – Beatles1692
Verificare la risposta Jon Skeet –
Il ConformanceLevel predefinito è Documento, che in base a MSDN indica che è necessario un documento XML 1.1: http://msdn.microsoft.com/en-us/library/h2344bs2.aspx – user7116