XmlSchemaSet.Remove(XmlSchema) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menghapus skema bahasa definisi Skema XML (XSD) yang ditentukan dari XmlSchemaSet.
public:
System::Xml::Schema::XmlSchema ^ Remove(System::Xml::Schema::XmlSchema ^ schema);
public System.Xml.Schema.XmlSchema? Remove(System.Xml.Schema.XmlSchema schema);
public System.Xml.Schema.XmlSchema Remove(System.Xml.Schema.XmlSchema schema);
member this.Remove : System.Xml.Schema.XmlSchema -> System.Xml.Schema.XmlSchema
Public Function Remove (schema As XmlSchema) As XmlSchema
Parameter
- schema
- XmlSchema
Objek XmlSchema yang akan dihapus dari XmlSchemaSet.
Mengembalikan
Objek XmlSchema dihapus dari XmlSchemaSet atau null jika skema tidak ditemukan di XmlSchemaSet.
Pengecualian
Skema ini bukan skema yang valid.
Yang XmlSchema diteruskan sebagai parameter adalah null.
Contoh
Contoh berikut mengilustrasikan penambahan beberapa skema ke XmlSchemaSet, lalu menghapus salah satu skema menggunakan Remove metode .
Dim schemaSet As XmlSchemaSet = New XmlSchemaSet()
schemaSet.Add("http://www.contoso.com/retail", "http://www.contoso.com/retail.xsd")
schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd")
schemaSet.Add("http://www.contoso.com/music", "http://www.contoso.com/music.xsd")
Dim schema As XmlSchema
For Each schema In schemaSet.Schemas()
If schema.TargetNamespace = "http://www.contoso.com/music" Then
schemaSet.Remove(schema)
End If
Next
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add("http://www.contoso.com/retail", "http://www.contoso.com/retail.xsd");
schemaSet.Add("http://www.contoso.com/books", "http://www.contoso.com/books.xsd");
schemaSet.Add("http://www.contoso.com/music", "http://www.contoso.com/music.xsd");
foreach (XmlSchema schema in schemaSet.Schemas())
{
if (schema.TargetNamespace == "http://www.contoso.com/music")
{
schemaSet.Remove(schema);
}
}
Keterangan
Menghapus skema dari XmlSchemaSet set properti ke IsCompiledfalse.