XmlReader.SchemaInfo 属性
定义
获取作为架构验证结果分配给当前节点的架构信息。Gets the schema information that has been assigned to the current node as a result of schema validation.
public:
virtual property System::Xml::Schema::IXmlSchemaInfo ^ SchemaInfo { System::Xml::Schema::IXmlSchemaInfo ^ get(); };
public virtual System.Xml.Schema.IXmlSchemaInfo? SchemaInfo { get; }
public virtual System.Xml.Schema.IXmlSchemaInfo SchemaInfo { get; }
member this.SchemaInfo : System.Xml.Schema.IXmlSchemaInfo
Public Overridable ReadOnly Property SchemaInfo As IXmlSchemaInfo
属性值
一个包含当前节点的架构信息的 IXmlSchemaInfo 对象。An IXmlSchemaInfo object containing the schema information for the current node. 架构信息可以在元素、特性或具有非空 ValueType(类型化值)的文本节点上设置。Schema information can be set on elements, attributes, or on text nodes with a non-null ValueType (typed values).
如果当前节点不属于上述节点类型,或者如果 XmlReader
实例未报告架构信息,则此属性返回 null
。If the current node is not one of the above node types, or if the XmlReader
instance does not report schema information, this property returns null
.
如果从 XmlTextReader 或 XmlValidatingReader 对象调用此属性,则此属性总是返回 null
。If this property is called from an XmlTextReader or an XmlValidatingReader object, this property always returns null
. 这些 XmlReader
实现不会通过 SchemaInfo
属性公开架构信息。These XmlReader
implementations do not expose schema information through the SchemaInfo
property.
如果必须为某个元素获取架构验证后信息集 (PSVI),请在此元素的结束标记处(而不是在开始标记处)放置读取器。If you have to get the post-schema-validation information set (PSVI) for an element, position the reader on the end tag of the element, rather than on the start tag. 您可以通过读取器的 SchemaInfo
属性获取 PSVI。You get the PSVI through the SchemaInfo
property of a reader. 通过 Create 并使用设置为 ValidationType 的 Schema 属性创建的验证读取器具有完整的 PSVI,仅在将读取器放置在元素的结束标记处时,此 PSVI 才对元素可用。The validating reader that is created through Create with the ValidationType property set to Schema has complete PSVI for an element only when the reader is positioned on the end tag of an element.
例外
在上一次异步操作完成之前调用了 XmlReader 方法。An XmlReader method was called before a previous asynchronous operation finished. 在此情况下,会引发 InvalidOperationException 并显示消息“异步操作已在进行中。”In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."
注解
IXmlSchemaInfo接口公开了一小部分架构验证信息集, (PSVI) 与 XML 节点关联。The IXmlSchemaInfo interface exposes a subset of the Post Schema Validation Infoset (PSVI) associated with an XML node.