XmlSchemaSet.Reprocess(XmlSchema) 方法


重新處理已存在於 XmlSchemaSet 中的 XML 結構描述定義語言 (XSD) 結構描述。Reprocesses an XML Schema definition language (XSD) schema that already exists in the XmlSchemaSet.

 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



要重新處理的結構描述。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.


下列範例說明如何重新處理新增至 XmlSchemaSet的架構。The following example illustrates reprocessing a schema added to the XmlSchemaSet. 使用 Compile 方法編譯 XmlSchemaSet 並修改加入至 XmlSchemaSet 的架構之後,即使已修改 true中的架構,IsCompiled 屬性也會設定為 [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")  
Dim element As XmlSchemaElement = New XmlSchemaElement()  
element.Name = "book"  
element.SchemaTypeName = New XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")  
XmlSchemaSet schemaSet = new XmlSchemaSet();  
XmlSchema schema = schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd");  
XmlSchemaElement element = new XmlSchemaElement();  
element.Name = "book";  
element.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");  


重新處理架構會在呼叫 Add 方法時,執行在架構上執行的所有前置處理步驟。Reprocessing a schema performs all the preprocessing steps performed on a schema when the Add method is called. 如果 Reprocess 的呼叫成功,IsCompiled 屬性會設定為 [false]。If 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.


如果您已在將架構(或它的其中一個包含/匯入)新增至 XmlSchemaSet之後,變更它,則需要呼叫 Reprocess 方法。You 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 物件,而包含的架構則會成為包含 XmlSchema的一部分。Imported 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.