Skip to Main Content
C# in a Nutshell, Second Edition
book

C# in a Nutshell, Second Edition

by Peter Drayton, Ben Albahari, Ted Neward
August 2003
Intermediate to advanced content levelIntermediate to advanced
928 pages
32h 1m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell, Second Edition

Name

XmlValidatingReader

Synopsis

This class is an XML reader that supports DTD and schema validation. The type of validation to perform is contained in the ValidationType property, which can be DTD, Schema, XDR, or Auto. Auto is the default and determines which type of validation is required, if any, based on the document. If the DOCTYPE element contains DTD information, that is used. If a schema attribute exists or there is an inline <schema>, that schema is used.

This class implements an event handler that you can set to warn of validation errors during Read( ) operations. Specifically, a delegate instance of type System.Xml.Schema.ValidationEventHandler can be set for the ValidationEventHandler event in this class. This delegate instance is invoked whenever the XmlValidatingReader finds an schema-invalid construct in the XML document it is reading, giving the delegate a chance to perform whatever error-handling is appropriate. If no event handler is registered, an XmlException is thrown instead on the first error.

public class XmlValidatingReader: XmlReader,  IXmlLineInfo {
// Public Constructors
   public XmlValidatingReader(System.IO.Stream xmlFragment, XmlNodeType fragType, XmlParserContext context);
   public XmlValidatingReader(string xmlFragment, XmlNodeType fragType, XmlParserContext context);
   public XmlValidatingReader(XmlReader reader);
// Public Instance Properties
   public override int AttributeCount{get; }          
// overrides XmlReader
   public override string BaseURI{get; } 
// overrides ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# in a Nutshell

C# in a Nutshell

Ben Albahari, Ted Neward, Peter Drayton
C# 7.0 in a Nutshell

C# 7.0 in a Nutshell

Joseph Albahari, Ben Albahari
C# Cookbook, 2nd Edition

C# Cookbook, 2nd Edition

Jay Hilyard, Stephen Teilhet
C# Cookbook

C# Cookbook

Joe Mayo

Publisher Resources

ISBN: 0596005261Catalog PageErrata