This topic has not yet been rated - Rate this topic

XmlValidatingReader Class

Note: This API is now obsolete.

Represents a reader that provides document type definition (DTD), XML-Data Reduced (XDR) schema, and XML Schema definition language (XSD) validation.

System.Object
  System.Xml.XmlReader
    System.Xml.XmlValidatingReader

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)
[ObsoleteAttribute("Use XmlReader created by XmlReader.Create() method using appropriate XmlReaderSettings instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public class XmlValidatingReader : XmlReader, 
	IXmlLineInfo, IXmlNamespaceResolver

The XmlValidatingReader type exposes the following members.

  Name Description
Public method XmlValidatingReader(XmlReader) Initializes a new instance of the XmlValidatingReader class that validates the content returned from the given XmlReader.
Public method XmlValidatingReader(Stream, XmlNodeType, XmlParserContext) Initializes a new instance of the XmlValidatingReader class with the specified values.
Public method XmlValidatingReader(String, XmlNodeType, XmlParserContext) Initializes a new instance of the XmlValidatingReader class with the specified values.
Top
  Name Description
Public property AttributeCount Gets the number of attributes on the current node. (Overrides XmlReader.AttributeCount.)
Public property BaseURI Gets the base URI of the current node. (Overrides XmlReader.BaseURI.)
Public property CanReadBinaryContent Gets a value indicating whether the XmlValidatingReader implements the binary content read methods. (Overrides XmlReader.CanReadBinaryContent.)
Public property CanReadValueChunk Gets a value indicating whether the XmlReader implements the ReadValueChunk method. (Inherited from XmlReader.)
Public property CanResolveEntity Gets a value indicating whether this reader can parse and resolve entities. (Overrides XmlReader.CanResolveEntity.)
Public property Depth Gets the depth of the current node in the XML document. (Overrides XmlReader.Depth.)
Public property Encoding Gets the encoding attribute for the document.
Public property EntityHandling Gets or sets a value that specifies how the reader handles entities.
Public property EOF Gets a value indicating whether the reader is positioned at the end of the stream. (Overrides XmlReader.EOF.)
Public property HasAttributes Gets a value indicating whether the current node has any attributes. (Inherited from XmlReader.)
Public property HasValue Gets a value indicating whether the current node can have a Value other than String.Empty. (Overrides XmlReader.HasValue.)
Public property IsDefault Gets a value indicating whether the current node is an attribute that was generated from the default value defined in the document type definition (DTD) or schema. (Overrides XmlReader.IsDefault.)
Public property IsEmptyElement Gets a value indicating whether the current node is an empty element (for example, <MyElement/>). (Overrides XmlReader.IsEmptyElement.)
Public property Item[Int32] When overridden in a derived class, gets the value of the attribute with the specified index. (Inherited from XmlReader.)
Public property Item[String] When overridden in a derived class, gets the value of the attribute with the specified Name. (Inherited from XmlReader.)
Public property Item[String, String] When overridden in a derived class, gets the value of the attribute with the specified LocalName and NamespaceURI. (Inherited from XmlReader.)
Public property LineNumber Gets the current line number.
Public property LinePosition Gets the current line position.
Public property LocalName Gets the local name of the current node. (Overrides XmlReader.LocalName.)
Public property Name Gets the qualified name of the current node. (Overrides XmlReader.Name.)
Public property Namespaces Gets or sets a value indicating whether to do namespace support.
Public property NamespaceURI Gets the namespace Uniform Resource Identifier (URI) (as defined in the World Wide Web Consortium (W3C) Namespace specification) of the node on which the reader is positioned. (Overrides XmlReader.NamespaceURI.)
Public property NameTable Gets the XmlNameTable associated with this implementation. (Overrides XmlReader.NameTable.)
Public property NodeType Gets the type of the current node. (Overrides XmlReader.NodeType.)
Public property Prefix Gets the namespace prefix associated with the current node. (Overrides XmlReader.Prefix.)
Public property QuoteChar Gets the quotation mark character used to enclose the value of an attribute node. (Overrides XmlReader.QuoteChar.)
Public property Reader Gets the XmlReader used to construct this XmlValidatingReader.
Public property ReadState Gets the state of the reader. (Overrides XmlReader.ReadState.)
Public property SchemaInfo Gets the schema information that has been assigned to the current node as a result of schema validation. (Inherited from XmlReader.)
Public property Schemas Gets a XmlSchemaCollection to use for validation.
Public property SchemaType Gets a schema type object.
Public property Settings Gets the XmlReaderSettings object used to create this XmlReader instance. (Inherited from XmlReader.)
Public property ValidationType Gets or sets a value indicating the type of validation to perform.
Public property Value Gets the text value of the current node. (Overrides XmlReader.Value.)
Public property ValueType Gets The Common Language Runtime (CLR) type for the current node. (Inherited from XmlReader.)
Public property XmlLang Gets the current xml:lang scope. (Overrides XmlReader.XmlLang.)
Public property XmlResolver Sets the XmlResolver used for resolving external document type definition (DTD) and schema location references. The XmlResolver is also used to handle any import or include elements found in XML Schema definition language (XSD) schemas.
Public property XmlSpace Gets the current xml:space scope. (Overrides XmlReader.XmlSpace.)
Top
  Name Description
Public method Close Changes the ReadState to Closed. (Overrides XmlReader.Close().)
Protected method Dispose(Boolean) Releases the unmanaged resources used by the XmlReader and optionally releases the managed resources. (Inherited from XmlReader.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetAttribute(Int32) Gets the value of the attribute with the specified index. (Overrides XmlReader.GetAttribute(Int32).)
Public method GetAttribute(String) Gets the value of the attribute with the specified name. (Overrides XmlReader.GetAttribute(String).)
Public method GetAttribute(String, String) Gets the value of the attribute with the specified local name and namespace Uniform Resource Identifier (URI). (Overrides XmlReader.GetAttribute(String, String).)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method HasLineInfo Gets a value indicating whether the class can return line information.
Public method IsStartElement() Calls MoveToContent and tests if the current content node is a start tag or empty element tag. (Inherited from XmlReader.)
Public method IsStartElement(String) Calls MoveToContent and tests if the current content node is a start tag or empty element tag and if the Name property of the element found matches the given argument. (Inherited from XmlReader.)
Public method IsStartElement(String, String) Calls MoveToContent and tests if the current content node is a start tag or empty element tag and if the LocalName and NamespaceURI properties of the element found match the given strings. (Inherited from XmlReader.)
Public method LookupNamespace Resolves a namespace prefix in the current element's scope. (Overrides XmlReader.LookupNamespace(String).)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method MoveToAttribute(Int32) Moves to the attribute with the specified index. (Overrides XmlReader.MoveToAttribute(Int32).)
Public method MoveToAttribute(String) Moves to the attribute with the specified name. (Overrides XmlReader.MoveToAttribute(String).)
Public method MoveToAttribute(String, String) Moves to the attribute with the specified local name and namespace Uniform Resource Identifier (URI). (Overrides XmlReader.MoveToAttribute(String, String).)
Public method MoveToContent Checks whether the current node is a content (non-white space text, CDATA, Element, EndElement, EntityReference, or EndEntity) node. If the node is not a content node, the reader skips ahead to the next content node or end of file. It skips over nodes of the following type: ProcessingInstruction, DocumentType, Comment, Whitespace, or SignificantWhitespace. (Inherited from XmlReader.)
Public method MoveToElement Moves to the element that contains the current attribute node. (Overrides XmlReader.MoveToElement().)
Public method MoveToFirstAttribute Moves to the first attribute. (Overrides XmlReader.MoveToFirstAttribute().)
Public method MoveToNextAttribute Moves to the next attribute. (Overrides XmlReader.MoveToNextAttribute().)
Public method Read Reads the next node from the stream. (Overrides XmlReader.Read().)
Public method ReadAttributeValue Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes. (Overrides XmlReader.ReadAttributeValue().)
Public method ReadContentAs Reads the content as an object of the type specified. (Inherited from XmlReader.)
Public method ReadContentAsBase64 Reads the content and returns the Base64 decoded binary bytes. (Overrides XmlReader.ReadContentAsBase64(Byte[], Int32, Int32).)
Public method ReadContentAsBinHex Reads the content and returns the BinHex decoded binary bytes. (Overrides XmlReader.ReadContentAsBinHex(Byte[], Int32, Int32).)
Public method ReadContentAsBoolean Reads the text content at the current position as a Boolean. (Inherited from XmlReader.)
Public method ReadContentAsDateTime Reads the text content at the current position as a DateTime object. (Inherited from XmlReader.)
Public method ReadContentAsDecimal Reads the text content at the current position as a Decimal object. (Inherited from XmlReader.)
Public method ReadContentAsDouble Reads the text content at the current position as a double-precision floating-point number. (Inherited from XmlReader.)
Public method ReadContentAsFloat Reads the text content at the current position as a single-precision floating point number. (Inherited from XmlReader.)
Public method ReadContentAsInt Reads the text content at the current position as a 32-bit signed integer. (Inherited from XmlReader.)
Public method ReadContentAsLong Reads the text content at the current position as a 64-bit signed integer. (Inherited from XmlReader.)
Public method ReadContentAsObject Reads the text content at the current position as an Object. (Inherited from XmlReader.)
Public method ReadContentAsString Reads the text content at the current position as a String object. (Inherited from XmlReader.)
Public method ReadElementContentAs(Type, IXmlNamespaceResolver) Reads the element content as the requested type. (Inherited from XmlReader.)
Public method ReadElementContentAs(Type, IXmlNamespaceResolver, String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type. (Inherited from XmlReader.)
Public method ReadElementContentAsBase64 Reads the element and decodes the Base64 content. (Overrides XmlReader.ReadElementContentAsBase64(Byte[], Int32, Int32).)
Public method ReadElementContentAsBinHex Reads the element and decodes the BinHex content. (Overrides XmlReader.ReadElementContentAsBinHex(Byte[], Int32, Int32).)
Public method ReadElementContentAsBoolean() Reads the current element and returns the contents as a Boolean object. (Inherited from XmlReader.)
Public method ReadElementContentAsBoolean(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Boolean object. (Inherited from XmlReader.)
Public method ReadElementContentAsDateTime() Reads the current element and returns the contents as a DateTime object. (Inherited from XmlReader.)
Public method ReadElementContentAsDateTime(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a DateTime object. (Inherited from XmlReader.)
Public method ReadElementContentAsDecimal() Reads the current element and returns the contents as a Decimal object. (Inherited from XmlReader.)
Public method ReadElementContentAsDecimal(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Decimal object. (Inherited from XmlReader.)
Public method ReadElementContentAsDouble() Reads the current element and returns the contents as a double-precision floating-point number. (Inherited from XmlReader.)
Public method ReadElementContentAsDouble(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a double-precision floating-point number. (Inherited from XmlReader.)
Public method ReadElementContentAsFloat() Reads the current element and returns the contents as single-precision floating-point number. (Inherited from XmlReader.)
Public method ReadElementContentAsFloat(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a single-precision floating-point number. (Inherited from XmlReader.)
Public method ReadElementContentAsInt() Reads the current element and returns the contents as a 32-bit signed integer. (Inherited from XmlReader.)
Public method ReadElementContentAsInt(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 32-bit signed integer. (Inherited from XmlReader.)
Public method ReadElementContentAsLong() Reads the current element and returns the contents as a 64-bit signed integer. (Inherited from XmlReader.)
Public method ReadElementContentAsLong(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 64-bit signed integer. (Inherited from XmlReader.)
Public method ReadElementContentAsObject() Reads the current element and returns the contents as an Object. (Inherited from XmlReader.)
Public method ReadElementContentAsObject(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as an Object. (Inherited from XmlReader.)
Public method ReadElementContentAsString() Reads the current element and returns the contents as a String object. (Inherited from XmlReader.)
Public method ReadElementContentAsString(String, String) Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a String object. (Inherited from XmlReader.)
Public method ReadElementString() Reads a text-only element. (Inherited from XmlReader.)
Public method ReadElementString(String) Checks that the Name property of the element found matches the given string before reading a text-only element. (Inherited from XmlReader.)
Public method ReadElementString(String, String) Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element. (Inherited from XmlReader.)
Public method ReadEndElement Checks that the current content node is an end tag and advances the reader to the next node. (Inherited from XmlReader.)
Public method ReadInnerXml When overridden in a derived class, reads all the content, including markup, as a string. (Inherited from XmlReader.)
Public method ReadOuterXml When overridden in a derived class, reads the content, including markup, representing this node and all its children. (Inherited from XmlReader.)
Public method ReadStartElement() Checks that the current node is an element and advances the reader to the next node. (Inherited from XmlReader.)
Public method ReadStartElement(String) Checks that the current content node is an element with the given Name and advances the reader to the next node. (Inherited from XmlReader.)
Public method ReadStartElement(String, String) Checks that the current content node is an element with the given LocalName and NamespaceURI and advances the reader to the next node. (Inherited from XmlReader.)
Public method ReadString Reads the contents of an element or text node as a string. (Overrides XmlReader.ReadString().)
Public method ReadSubtree Returns a new XmlReader instance that can be used to read the current node, and all its descendants. (Inherited from XmlReader.)
Public method ReadToDescendant(String) Advances the XmlReader to the next descendant element with the specified qualified name. (Inherited from XmlReader.)
Public method ReadToDescendant(String, String) Advances the XmlReader to the next descendant element with the specified local name and namespace URI. (Inherited from XmlReader.)
Public method ReadToFollowing(String) Reads until an element with the specified qualified name is found. (Inherited from XmlReader.)
Public method ReadToFollowing(String, String) Reads until an element with the specified local name and namespace URI is found. (Inherited from XmlReader.)
Public method ReadToNextSibling(String) Advances the XmlReader to the next sibling element with the specified qualified name. (Inherited from XmlReader.)
Public method ReadToNextSibling(String, String) Advances the XmlReader to the next sibling element with the specified local name and namespace URI. (Inherited from XmlReader.)
Public method ReadTypedValue Gets the common language runtime type for the specified XML Schema definition language (XSD) type.
Public method ReadValueChunk Reads large streams of text embedded in an XML document. (Inherited from XmlReader.)
Public method ResolveEntity Resolves the entity reference for EntityReference nodes. (Overrides XmlReader.ResolveEntity().)
Public method Skip Skips the children of the current node. (Inherited from XmlReader.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
  Name Description
Public event ValidationEventHandler Sets an event handler for receiving information about document type definition (DTD), XML-Data Reduced (XDR) schema, and XML Schema definition language (XSD) schema validation errors.
Top
  Name Description
Explicit interface implemetation Private method IDisposable.Dispose For a description of this member, see IDisposable.Dispose. (Inherited from XmlReader.)
Explicit interface implemetation Private method IXmlNamespaceResolver.GetNamespacesInScope Infrastructure. For a description of this member, see IXmlNamespaceResolver.GetNamespacesInScope.
Explicit interface implemetation Private method IXmlNamespaceResolver.LookupNamespace Infrastructure. For a description of this member, see IXmlNamespaceResolver.LookupNamespace.
Explicit interface implemetation Private method IXmlNamespaceResolver.LookupPrefix Infrastructure. For a description of this member, see IXmlNamespaceResolver.LookupPrefix.
Top

XmlValidatingReader implements the XmlReader class and provides support for data validation. Use the Schemas property to have the reader validate by using schema files that are cached in an XmlSchemaCollection. The ValidationType property specifies what type of validation the reader should perform. Setting the property to ValidationType.None creates a non-validating reader.

XmlValidatingReader throws an XmlException on XML parse errors. After an exception is thrown the state of the reader is not predictable. For example, the reported node type may be different than the actual node type of the current node. Use the ReadState property to check whether a reader is in error state.

Note Note

The XmlValidatingReader class is obsolete in .NET Framework version 2.0. You can create a validating XmlReader instance by using the XmlReaderSettings class and the Create method. For more information, see Validating XML Data with XmlReader.

Notes to Inheritors

This class has an inheritance demand. Full trust is required to inherit from XmlValidatingReader. For more information, see Inheritance Demands.

.NET Framework

Supported in: 1.1, 1.0
Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5
Obsolete (compiler warning) in 3.5 SP1
Obsolete (compiler warning) in 3.0
Obsolete (compiler warning) in 3.0 SP1
Obsolete (compiler warning) in 3.0 SP2
Obsolete (compiler warning) in 2.0
Obsolete (compiler warning) in 2.0 SP1
Obsolete (compiler warning) in 2.0 SP2

.NET Framework Client Profile

Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ