Validation

An XML API would just not be complete without the ability to validate XML. So LINQ to XML has the ability to validate an XML document against an XML schema.

The Extension Methods

LINQ to XML has addressed the need for validation by creating the System.Xml.Schema.Extensions static class, which contains the validation methods. These validation methods are implemented as extension methods.

Prototypes

Here is a list of some of the validation method prototypes available in the System.Xml.Schema.Extensions class:

void Extensions.Validate(this XDocument source, XmlSchemaSet schemas,
  ValidationEventHandler validationEventHandler)

void Extensions.Validate(this XDocument source, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler, ...

Get Pro LINQ: Language Integrated Query in C# 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.