Dave
Dave

Reputation: 3717

Can anyone explain XSD versions

I am writing an XSD schema and C# code to read an XML file and verify it against the XSD:

XmlDocument myDocument = new XmlDocument();    
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.ValidationType = ValidationType.Schema;
xmlReaderSettings.Schemas.Add(null, "MyXsd.xsd");
using (XmlReader xmlReader = XmlReader.Create("MyXml", xmlReaderSettings))
{
    myDocument.Load(xmlReader);
}

I'm not very experienced with XSD so I am referring to all sorts of web sites for help, but I keep coming across things like "This will work in XSD1.0 but not XSD1.1", or "with XSD2.0 do it this way". Can someone explain how I know or specify what version of XSD will be used. I'm using VS2012 - I don't even know if that is relevant.

Upvotes: 2

Views: 571

Answers (1)

kjhughes
kjhughes

Reputation: 111501

Commonly answers will state that XSD 1.1 is required in order express a constraint that requires assertions or conditional type assignment, but there are many other improvements from XSD 1.0 to 1.1 as well.

.NET only supports XSD 1.0. Use Saxon for XSD 1.1 support in .NET (and in Java).

Upvotes: 1

Related Questions