XmlValidatingReader.Schemas Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a XmlSchemaCollection to use for validation.
public:
property System::Xml::Schema::XmlSchemaCollection ^ Schemas { System::Xml::Schema::XmlSchemaCollection ^ get(); };
public System.Xml.Schema.XmlSchemaCollection Schemas { get; }
member this.Schemas : System.Xml.Schema.XmlSchemaCollection
Public ReadOnly Property Schemas As XmlSchemaCollection
Property Value
The XmlSchemaCollection
to use for validation.
Remarks
Note
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.
The XmlSchemaCollection
holds pre-loaded XML-Data Reduced (XDR) and XML Schema definition language (XSD) schemas. This property gives the reader access to the cache of schemas and allows it to validate without having to re-load schemas every time. The reader does not add anything to the XmlSchemaCollection
.
If the XmlSchemaCollection
includes an XML schema (XSD) that contains include
or import
elements that reference other namespaces, the schemas for these other namespaces are loaded for validation purposes only. Unless these schemas were explicitly added to the schema collection, they will not be accessible using any of the collection methods or properties. For example, if the collection contains the schema file a.xsd
, which contains a reference to the schema file b.xsd
, you must add b.xsd
to the schema collection before you can access it using any of the collection methods or properties.
When the XmlSchemaCollection
is accessed using the Schemas
property, the XmlSchemaCollection.Add method uses the XmlResolver specified by the XmlValidatingReader.XmlResolver property.
Note
The schemas must be added to the XmlSchemaCollection
before the first Read
call.