XmlSchemaSet.Remove(XmlSchema) Metoda

Definice

Odebere zadané schéma XSD (XML Schema Definition Language) ze schématu 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

Parametry

schema
XmlSchema

Objekt XmlSchema , který chcete odebrat z objektu XmlSchemaSet.

Návraty

XmlSchema

Objekt XmlSchema byl odebrán z objektu XmlSchemaSet nebo null pokud schéma nebylo nalezeno v souboru XmlSchemaSet.

Výjimky

Schéma není platné schéma.

Předaný XmlSchema jako parametr je null.

Příklady

Následující příklad znázorňuje přidání více schémat do objektu XmlSchemaSeta následné odebrání jednoho ze schémat pomocí Remove metody.

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);  
    }  
}  

Poznámky

Odebrání schématu XmlSchemaSet ze sady IsCompiled vlastnosti na false.

Platí pro