XmlSchemaSet.Reprocess(XmlSchema) XmlSchemaSet.Reprocess(XmlSchema) XmlSchemaSet.Reprocess(XmlSchema) XmlSchemaSet.Reprocess(XmlSchema) Method

定义

重新处理已经存在于 XmlSchemaSet 中的 XML 架构定义语言 (XSD) 架构。Reprocesses an XML Schema definition language (XSD) schema that already exists in the XmlSchemaSet.

public:
 System::Xml::Schema::XmlSchema ^ Reprocess(System::Xml::Schema::XmlSchema ^ schema);
public System.Xml.Schema.XmlSchema Reprocess (System.Xml.Schema.XmlSchema schema);
member this.Reprocess : System.Xml.Schema.XmlSchema -> System.Xml.Schema.XmlSchema
Public Function Reprocess (schema As XmlSchema) As XmlSchema

参数

schema
XmlSchema XmlSchema XmlSchema XmlSchema

要重新处理的架构。The schema to reprocess.

返回

如果架构有效,则为 XmlSchema 对象。An XmlSchema object if the schema is a valid schema. 如果架构无效且指定了 ValidationEventHandler,则将返回 null 并引发适当的验证事件。If the schema is not valid and a ValidationEventHandler is specified, null is returned and the appropriate validation event is raised. 否则会引发 XmlSchemaExceptionOtherwise, an XmlSchemaException is thrown.

异常

该架构无效。The schema is not valid.

作为参数传递的 XmlSchema 对象为 nullThe XmlSchema object passed as a parameter is null.

作为参数传递的 XmlSchema 对象并不存在于 XmlSchemaSet 中。The XmlSchema object passed as a parameter does not already exist in the XmlSchemaSet.

示例

下面的示例演示如何重新处理架构添加到XmlSchemaSetThe following example illustrates reprocessing a schema added to the XmlSchemaSet. XmlSchemaSet使用编译Compile方法,并添加到架构XmlSchemaSet修改IsCompiled属性将设置为true,即使在架构XmlSchemaSet已被修改。After the XmlSchemaSet is compiled using the Compile method, and the schema added to the XmlSchemaSet is modified, the IsCompiled property will be set to true, even though a schema in the XmlSchemaSet has been modified. 调用Reprocess方法执行由执行的所有预处理Add方法和集IsCompiled属性设置为falseCalling the Reprocess method performs all the preprocessing performed by the Add method and sets the IsCompiled property to false.

Dim schemaSet As XmlSchemaSet = New XmlSchemaSet()  
Dim schema As XmlSchema = schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd")  
schemaSet.Compile()  

Dim element As XmlSchemaElement = New XmlSchemaElement()  
schema.Items.Add(element)  
element.Name = "book"  
element.SchemaTypeName = New XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")  

schemaSet.Reprocess(schema)  
XmlSchemaSet schemaSet = new XmlSchemaSet();  
XmlSchema schema = schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd");  
schemaSet.Compile();  

XmlSchemaElement element = new XmlSchemaElement();  
schema.Items.Add(element);  
element.Name = "book";  
element.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");  

schemaSet.Reprocess(schema);  

注解

重新处理架构执行对架构执行的所有预处理步骤时Add调用方法。Reprocessing a schema performs all the preprocessing steps performed on a schema when the Add method is called. 如果在调用Reprocess是否成功,请IsCompiled属性设置为falseIf the call to Reprocess is successful, the IsCompiled property is set to false.

中的架构之后,应使用重新处理方法XmlSchemaSet已被修改,之后XmlSchemaSet执行编译。The Reprocess method should be used after a schema in the XmlSchemaSet has been modified, after the XmlSchemaSet has performed compilation.

备注

您需要调用Reprocess方法,如果已将其添加到后更改架构 (或其的包括/导入之一) XmlSchemaSetYou need to call the Reprocess method if you have changed a schema (or one of its includes/imports) after adding it to the XmlSchemaSet. Reprocess方法将检查架构的结构根据 W3C XML 架构的规则的有效性。The Reprocess method will check the schema for structural validity according to the rules of W3C XML Schema. 但是,它不会执行完整的验证检查。However, it will not perform a full validation check. 它还会解析到内部和外部架构组件的引用。It will also resolve references to internal and external schema components. 已成功检索到任何导入或包含架构也会添加到XmlSchemaSetAny imported or included schemas that are successfully retrieved are also added to the XmlSchemaSet. 导入的架构添加作为单独XmlSchema对象时包括架构所做的包括一部分XmlSchemaImported schemas are added as separate XmlSchema objects while included schemas are made part of the including XmlSchema. 如果要重新处理的调用成功,IsCompiled属性设置为 false。If the call to reprocess is successful, the IsCompiled property is set to false.

适用于