Export (0) Print
Expand All

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.

This class is obsolete. Starting with the .NET Framework 2.0, we recommend that you use the XmlReaderSettings class and the XmlReader::Create method to create a validating XML reader.

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

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

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

The XmlValidatingReader type exposes the following members.

  NameDescription
Public methodXmlValidatingReader(XmlReader)Initializes a new instance of the XmlValidatingReader class that validates the content returned from the given XmlReader.
Public methodXmlValidatingReader(Stream, XmlNodeType, XmlParserContext)Initializes a new instance of the XmlValidatingReader class with the specified values.
Public methodXmlValidatingReader(String, XmlNodeType, XmlParserContext)Initializes a new instance of the XmlValidatingReader class with the specified values.
Top

  NameDescription
Public propertyAttributeCountGets the number of attributes on the current node. (Overrides XmlReader::AttributeCount.)
Public propertyBaseURIGets the base URI of the current node. (Overrides XmlReader::BaseURI.)
Public propertyCanReadBinaryContentGets a value indicating whether the XmlValidatingReader implements the binary content read methods. (Overrides XmlReader::CanReadBinaryContent.)
Public propertyCanReadValueChunkGets a value indicating whether the XmlReader implements the ReadValueChunk method. (Inherited from XmlReader.)
Public propertyCanResolveEntityGets a value indicating whether this reader can parse and resolve entities. (Overrides XmlReader::CanResolveEntity.)
Public propertyDepthGets the depth of the current node in the XML document. (Overrides XmlReader::Depth.)
Public propertyEncodingGets the encoding attribute for the document.
Public propertyEntityHandlingGets or sets a value that specifies how the reader handles entities.
Public propertyEOFGets a value indicating whether the reader is positioned at the end of the stream. (Overrides XmlReader::EOF.)
Public propertyHasAttributesGets a value indicating whether the current node has any attributes. (Inherited from XmlReader.)
Public propertyHasValueGets a value indicating whether the current node can have a Value other than String.Empty. (Overrides XmlReader::HasValue.)
Public propertyIsDefaultGets 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 propertyIsEmptyElementGets a value indicating whether the current node is an empty element (for example, <MyElement/>). (Overrides XmlReader::IsEmptyElement.)
Public propertyItem[Int32]When overridden in a derived class, gets the value of the attribute with the specified index. (Inherited from XmlReader.)
Public propertyItem[String]When overridden in a derived class, gets the value of the attribute with the specified Name. (Inherited from XmlReader.)
Public propertyItem[String, String]When overridden in a derived class, gets the value of the attribute with the specified LocalName and NamespaceURI. (Inherited from XmlReader.)
Public propertyLineNumberGets the current line number.
Public propertyLinePositionGets the current line position.
Public propertyLocalNameGets the local name of the current node. (Overrides XmlReader::LocalName.)
Public propertyNameGets the qualified name of the current node. (Overrides XmlReader::Name.)
Public propertyNamespacesGets or sets a value indicating whether to do namespace support.
Public propertyNamespaceURIGets 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 propertyNameTableGets the XmlNameTable associated with this implementation. (Overrides XmlReader::NameTable.)
Public propertyNodeTypeGets the type of the current node. (Overrides XmlReader::NodeType.)
Public propertyPrefixGets the namespace prefix associated with the current node. (Overrides XmlReader::Prefix.)
Public propertyQuoteCharGets the quotation mark character used to enclose the value of an attribute node. (Overrides XmlReader::QuoteChar.)
Public propertyReaderGets the XmlReader used to construct this XmlValidatingReader.
Public propertyReadStateGets the state of the reader. (Overrides XmlReader::ReadState.)
Public propertySchemaInfoGets the schema information that has been assigned to the current node as a result of schema validation. (Inherited from XmlReader.)
Public propertySchemasGets a XmlSchemaCollection to use for validation.
Public propertySchemaTypeGets a schema type object.
Public propertySettingsGets the XmlReaderSettings object used to create this XmlReader instance. (Inherited from XmlReader.)
Public propertyValidationTypeGets or sets a value indicating the type of validation to perform.
Public propertyValueGets the text value of the current node. (Overrides XmlReader::Value.)
Public propertyValueTypeGets The Common Language Runtime (CLR) type for the current node. (Inherited from XmlReader.)
Public propertyXmlLangGets the current xml:lang scope. (Overrides XmlReader::XmlLang.)
Public propertyXmlResolverSets 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 propertyXmlSpaceGets the current xml:space scope. (Overrides XmlReader::XmlSpace.)
Top

  NameDescription
Public methodCloseChanges the ReadState to Closed. (Overrides XmlReader::Close().)
Public methodDispose()Releases all resources used by the current instance of the XmlReader class. (Inherited from XmlReader.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the XmlReader and optionally releases the managed resources. (Inherited from XmlReader.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAttribute(Int32)Gets the value of the attribute with the specified index. (Overrides XmlReader::GetAttribute(Int32).)
Public methodGetAttribute(String)Gets the value of the attribute with the specified name. (Overrides XmlReader::GetAttribute(String).)
Public methodGetAttribute(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 methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueAsyncAsynchronously gets the value of the current node. (Inherited from XmlReader.)
Public methodHasLineInfoGets a value indicating whether the class can return line information.
Public methodIsStartElement()Calls MoveToContent and tests if the current content node is a start tag or empty element tag. (Inherited from XmlReader.)
Public methodIsStartElement(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 methodIsStartElement(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 methodLookupNamespaceResolves a namespace prefix in the current element's scope. (Overrides XmlReader::LookupNamespace(String).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodMoveToAttribute(Int32)Moves to the attribute with the specified index. (Overrides XmlReader::MoveToAttribute(Int32).)
Public methodMoveToAttribute(String)Moves to the attribute with the specified name. (Overrides XmlReader::MoveToAttribute(String).)
Public methodMoveToAttribute(String, String)Moves to the attribute with the specified local name and namespace Uniform Resource Identifier (URI). (Overrides XmlReader::MoveToAttribute(String, String).)
Public methodMoveToContentChecks 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 methodMoveToContentAsyncAsynchronously checks whether the current node is a content node. If the node is not a content node, the reader skips ahead to the next content node or end of file. (Inherited from XmlReader.)
Public methodMoveToElementMoves to the element that contains the current attribute node. (Overrides XmlReader::MoveToElement().)
Public methodMoveToFirstAttributeMoves to the first attribute. (Overrides XmlReader::MoveToFirstAttribute().)
Public methodMoveToNextAttributeMoves to the next attribute. (Overrides XmlReader::MoveToNextAttribute().)
Public methodReadReads the next node from the stream. (Overrides XmlReader::Read().)
Public methodReadAsyncAsynchronously reads the next node from the stream. (Inherited from XmlReader.)
Public methodReadAttributeValueParses the attribute value into one or more Text, EntityReference, or EndEntity nodes. (Overrides XmlReader::ReadAttributeValue().)
Public methodReadContentAsReads the content as an object of the type specified. (Inherited from XmlReader.)
Public methodReadContentAsAsyncAsynchronously reads the content as an object of the type specified. (Inherited from XmlReader.)
Public methodReadContentAsBase64Reads the content and returns the Base64 decoded binary bytes. (Overrides XmlReader::ReadContentAsBase64(array<Byte>, Int32, Int32).)
Public methodReadContentAsBase64AsyncAsynchronously reads the content and returns the Base64 decoded binary bytes. (Inherited from XmlReader.)
Public methodReadContentAsBinHexReads the content and returns the BinHex decoded binary bytes. (Overrides XmlReader::ReadContentAsBinHex(array<Byte>, Int32, Int32).)
Public methodReadContentAsBinHexAsyncAsynchronously reads the content and returns the BinHex decoded binary bytes. (Inherited from XmlReader.)
Public methodReadContentAsBooleanReads the text content at the current position as a Boolean. (Inherited from XmlReader.)
Public methodReadContentAsDateTimeReads the text content at the current position as a DateTime object. (Inherited from XmlReader.)
Public methodReadContentAsDateTimeOffsetReads the text content at the current position as a DateTimeOffset object. (Inherited from XmlReader.)
Public methodReadContentAsDecimalReads the text content at the current position as a Decimal object. (Inherited from XmlReader.)
Public methodReadContentAsDoubleReads the text content at the current position as a double-precision floating-point number. (Inherited from XmlReader.)
Public methodReadContentAsFloatReads the text content at the current position as a single-precision floating point number. (Inherited from XmlReader.)
Public methodReadContentAsIntReads the text content at the current position as a 32-bit signed integer. (Inherited from XmlReader.)
Public methodReadContentAsLongReads the text content at the current position as a 64-bit signed integer. (Inherited from XmlReader.)
Public methodReadContentAsObjectReads the text content at the current position as an Object. (Inherited from XmlReader.)
Public methodReadContentAsObjectAsyncAsynchronously reads the text content at the current position as an Object. (Inherited from XmlReader.)
Public methodReadContentAsStringReads the text content at the current position as a String object. (Inherited from XmlReader.)
Public methodReadContentAsStringAsyncAsynchronously reads the text content at the current position as a String object. (Inherited from XmlReader.)
Public methodReadElementContentAs(Type, IXmlNamespaceResolver)Reads the element content as the requested type. (Inherited from XmlReader.)
Public methodReadElementContentAs(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 methodReadElementContentAsAsyncAsynchronously reads the element content as the requested type. (Inherited from XmlReader.)
Public methodReadElementContentAsBase64Reads the element and decodes the Base64 content. (Overrides XmlReader::ReadElementContentAsBase64(array<Byte>, Int32, Int32).)
Public methodReadElementContentAsBase64AsyncAsynchronously reads the element and decodes the Base64 content. (Inherited from XmlReader.)
Public methodReadElementContentAsBinHexReads the element and decodes the BinHex content. (Overrides XmlReader::ReadElementContentAsBinHex(array<Byte>, Int32, Int32).)
Public methodReadElementContentAsBinHexAsyncAsynchronously reads the element and decodes the BinHex content. (Inherited from XmlReader.)
Public methodReadElementContentAsBoolean()Reads the current element and returns the contents as a Boolean object. (Inherited from XmlReader.)
Public methodReadElementContentAsBoolean(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 methodReadElementContentAsDateTime()Reads the current element and returns the contents as a DateTime object. (Inherited from XmlReader.)
Public methodReadElementContentAsDateTime(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 methodReadElementContentAsDecimal()Reads the current element and returns the contents as a Decimal object. (Inherited from XmlReader.)
Public methodReadElementContentAsDecimal(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 methodReadElementContentAsDouble()Reads the current element and returns the contents as a double-precision floating-point number. (Inherited from XmlReader.)
Public methodReadElementContentAsDouble(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 methodReadElementContentAsFloat()Reads the current element and returns the contents as single-precision floating-point number. (Inherited from XmlReader.)
Public methodReadElementContentAsFloat(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 methodReadElementContentAsInt()Reads the current element and returns the contents as a 32-bit signed integer. (Inherited from XmlReader.)
Public methodReadElementContentAsInt(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 methodReadElementContentAsLong()Reads the current element and returns the contents as a 64-bit signed integer. (Inherited from XmlReader.)
Public methodReadElementContentAsLong(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 methodReadElementContentAsObject()Reads the current element and returns the contents as an Object. (Inherited from XmlReader.)
Public methodReadElementContentAsObject(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 methodReadElementContentAsObjectAsyncAsynchronously reads the current element and returns the contents as an Object. (Inherited from XmlReader.)
Public methodReadElementContentAsString()Reads the current element and returns the contents as a String object. (Inherited from XmlReader.)
Public methodReadElementContentAsString(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 methodReadElementContentAsStringAsyncAsynchronously reads the current element and returns the contents as a String object. (Inherited from XmlReader.)
Public methodReadElementString()Reads a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation. (Inherited from XmlReader.)
Public methodReadElementString(String)Checks that the Name property of the element found matches the given string before reading a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation. (Inherited from XmlReader.)
Public methodReadElementString(String, String)Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element. However, we recommend that you use the ReadElementContentAsString(String, String) method instead, because it provides a more straightforward way to handle this operation. (Inherited from XmlReader.)
Public methodReadEndElementChecks that the current content node is an end tag and advances the reader to the next node. (Inherited from XmlReader.)
Public methodReadInnerXmlWhen overridden in a derived class, reads all the content, including markup, as a string. (Inherited from XmlReader.)
Public methodReadInnerXmlAsyncAsynchronously reads all the content, including markup, as a string. (Inherited from XmlReader.)
Public methodReadOuterXmlWhen overridden in a derived class, reads the content, including markup, representing this node and all its children. (Inherited from XmlReader.)
Public methodReadOuterXmlAsyncAsynchronously reads the content, including markup, representing this node and all its children. (Inherited from XmlReader.)
Public methodReadStartElement()Checks that the current node is an element and advances the reader to the next node. (Inherited from XmlReader.)
Public methodReadStartElement(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 methodReadStartElement(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 methodReadStringReads the contents of an element or text node as a string. (Overrides XmlReader::ReadString().)
Public methodReadSubtreeReturns a new XmlReader instance that can be used to read the current node, and all its descendants. (Inherited from XmlReader.)
Public methodReadToDescendant(String)Advances the XmlReader to the next descendant element with the specified qualified name. (Inherited from XmlReader.)
Public methodReadToDescendant(String, String)Advances the XmlReader to the next descendant element with the specified local name and namespace URI. (Inherited from XmlReader.)
Public methodReadToFollowing(String)Reads until an element with the specified qualified name is found. (Inherited from XmlReader.)
Public methodReadToFollowing(String, String)Reads until an element with the specified local name and namespace URI is found. (Inherited from XmlReader.)
Public methodReadToNextSibling(String)Advances the XmlReader to the next sibling element with the specified qualified name. (Inherited from XmlReader.)
Public methodReadToNextSibling(String, String)Advances the XmlReader to the next sibling element with the specified local name and namespace URI. (Inherited from XmlReader.)
Public methodReadTypedValueGets the common language runtime type for the specified XML Schema definition language (XSD) type.
Public methodReadValueChunkReads large streams of text embedded in an XML document. (Inherited from XmlReader.)
Public methodReadValueChunkAsyncAsynchronously reads large streams of text embedded in an XML document. (Inherited from XmlReader.)
Public methodResolveEntityResolves the entity reference for EntityReference nodes. (Overrides XmlReader::ResolveEntity().)
Public methodSkipSkips the children of the current node. (Inherited from XmlReader.)
Public methodSkipAsyncAsynchronously skips the children of the current node. (Inherited from XmlReader.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventValidationEventHandlerSets 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

  NameDescription
Explicit interface implemetationPrivate methodIDisposable::DisposeFor a description of this member, see IDisposable::Dispose. (Inherited from XmlReader.)
Explicit interface implemetationPrivate methodIXmlNamespaceResolver::GetNamespacesInScopeInfrastructure. For a description of this member, see IXmlNamespaceResolver::GetNamespacesInScope.
Explicit interface implemetationPrivate methodIXmlNamespaceResolver::LookupNamespaceInfrastructure. For a description of this member, see IXmlNamespaceResolver::LookupNamespace.
Explicit interface implemetationPrivate methodIXmlNamespaceResolver::LookupPrefixInfrastructure. 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.

NoteNote

The XmlValidatingReader class is obsolete in .NET Framework 2.0. You can create a validating XmlReader instance by using the XmlReaderSettings class and the Create method. For more information, see the Remarks section of the XmlReader reference page.

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.5.2
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5
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 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Show:
© 2014 Microsoft