Xdocument validate not validating

Rated 3.91/5 based on 533 customer reviews

I wrote a method to validate and xml file against a schema. If the file does not conform to the schema, it throws an error. If I try to validate an XDocument (containing schema xml) against a schema url, it validates successfully..... I'm using LINQ to XML and trying to validate an XDocument object against an XSD.

xdocument validate not validating-6

xdocument validate not validating-17

If you use Xml Reader for validation you can use Xml Reader Settings with warnings enabled and you will get a warning emitted to your validation event handler.In .net, you can create a validating XML Reader by passing in Xml Reader Settings into Xml Reader.Create, but the built-in Validation Type is limited to W3C XML Schema (.xsd) or Document type definitions (.dtd).I have a project I’m working on that requires the use of some extensive XML manipulation.While XML can be very powerful, XML without a schema is like Java Script objects: no strong typing and the wild west as far as standards are concerned.

Leave a Reply