XmlSchemaSet.Reprocess(XmlSchema) 方法

定義

重新處理已存在於 XmlSchemaSet 中的 XML 結構描述定義語言 (XSD) 結構描述。

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 物件 (如果結構描述是有效的結構描述)。 如果結構描述無效,且指定了 ValidationEventHandler,則會傳回 null,並會引發適當的驗證事件。 否則會擲回 XmlSchemaException

例外狀況

此結構描述無效。

做為參數傳遞的 XmlSchema 物件為 null

以參數形式傳遞的 XmlSchema 物件不存在於 XmlSchemaSet 中。

範例

下列範例說明重新處理新增至 的 XmlSchemaSet 架構。 XmlSchemaSet使用 Compile 方法編譯 ,並修改加入 至 的 XmlSchemaSet 架構之後,即使 已修改 中的 XmlSchemaSet 架構, IsCompiled 屬性也會設定為 trueReprocess呼叫 方法會執行 方法執行 Add 的所有前置處理,並將 屬性設定 IsCompiledfalse

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 ,執行架構上執行的所有前置處理步驟。 如果 的呼叫 Reprocess 成功,屬性 IsCompiled 會設定為 false

重新處理方法應該在 中的架構 XmlSchemaSet 經過修改之後,于 執行編譯之後 XmlSchemaSet 使用。

注意

Reprocess如果您已變更架構 (或其其中一個包含/匯入) ,請將它新增至 XmlSchemaSet 之後呼叫 方法。 方法 Reprocess 會根據 W3C XML 架構的規則來檢查架構的結構有效性。 不過,它不會執行完整的驗證檢查。 它也會解析內部和外部架構元件的參考。 任何成功擷取的匯入或包含架構也會新增至 XmlSchemaSet 。 匯入的架構會新增為個別 XmlSchema 物件,而包含的架構會成為包含 XmlSchema 的一部分。 如果重新處理呼叫成功,屬性 IsCompiled 會設定為 false。

適用於