XmlSchemaSet.Remove(XmlSchema) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Supprime le schéma XSD (XML Schema Definition Language) spécifié de l’objet 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
Paramètres
- schema
- XmlSchema
Objet XmlSchema à supprimer du XmlSchemaSet.
Retours
Objet XmlSchema supprimé de l’objet XmlSchemaSet ou null si le schéma n’a pas été trouvé dans le XmlSchemaSet.
Exceptions
Le schéma n’est pas un schéma valide.
Le XmlSchema passé en tant que paramètre est null.
Exemples
L’exemple suivant illustre l’ajout de plusieurs schémas à un XmlSchemaSet, puis la suppression de l’un des schémas à l’aide de la Remove méthode.
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);
}
}
Remarques
Suppression d’un schéma des XmlSchemaSet jeux de la IsCompiled propriété sur false.