BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in .NET XML, System.XML

 
 
Page 16574 of 20217

New in .NET 2.0: Push-Based XML Validation with XmlSchemaValidator Class

Blogger : Oleg Tkachenko
All posts : All posts by Oleg Tkachenko
Category : .NET XML, System.XML
Blogged date : 2005 Aug 01

This is a real hidden gem in .NET 2.0 everybody (including me) have pretty much overlooked. XmlSchemaValidator class from the System.Xml.Schema namespace is a push-based W3C XML Schema validatation engine. Push-based means different processing model - an opposite for pull-based one. Think about how you work with XmlWriter (push) and XmlReader (pull). With (obsolete now) .NET 1.X`s XmlValidatingReader and .NET 2.0`s XmlReader with validation enabled you read XML to make sure it`s valid. With XmlSchemaValidator you do the opposite - you ask it to validate XML bits using ValidateElement, ValidateAttribute, ValidateText etc methods.

Which scenarios does XmlSchemaValidator enable:

  1. Validation of XML in-place, whithout necessity to reparse it by reading via XmlReader. This is actually how new XmlDocument.Validate() method is implemented.
  2. Validation of custom XML or even viewed-as-XML data stores
  3. Validation during XML construction - now it`s possible to create validating XmlWritrer. And I wonder why it`s not done yet That`s a job for XML MVPs for sure.
  4. Partial validation
  5. Access to PSVI (Post Schema Validation Information)
  6. Retrieving Expected Particles, Attributes, and Unspecified Default Attributes - this is how XML Editor in Visual Studio 2005 smart Intellisense works.
Quite impressive list and quite impressive class.


Read comments or post a reply to : New in .NET 2.0: Push-Based XML Validation with XmlSchemaValidator Class
Page 16574 of 20217

Newest posts
 

    Email TopXML