XmlSchemaValidator.AddSchema(XmlSchema) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將 XML 結構描述定義語言 (XSD) 結構描述加入一組用於驗證的結構描述。
public:
void AddSchema(System::Xml::Schema::XmlSchema ^ schema);
public void AddSchema (System.Xml.Schema.XmlSchema schema);
member this.AddSchema : System.Xml.Schema.XmlSchema -> unit
Public Sub AddSchema (schema As XmlSchema)
參數
例外狀況
指定的 XmlSchema 參數為 null。
XmlSchema 參數的目標命名空間與 XmlSchemaValidator 物件已經遇到之任何項目或屬性的目標命名空間都相符。
XmlSchema 參數無效。
備註
以下是使用 AddSchema 方法時要考慮的重要注意事項。
方法 AddSchema 可用來模擬在正在驗證之 XML 檔中遇到內嵌 XML 架構的效果。
XmlSchema 參數的目標命名空間與 XmlSchemaValidator 物件已遇到之任何項目或屬性的目標命名空間均不相符。
ProcessInlineSchema如果未設定驗證選項, AddSchema 則方法不會執行任何動作。