Export (0) Print
Expand All

XmlSchemaSet.Remove Method

Removes the specified XML Schema definition language (XSD) schema from the XmlSchemaSet.

Namespace:  System.Xml.Schema
Assembly:  System.Xml (in System.Xml.dll)

public XmlSchema Remove(
	XmlSchema schema
)

Parameters

schema
Type: System.Xml.Schema.XmlSchema

The XmlSchema object to remove from the XmlSchemaSet.

Return Value

Type: System.Xml.Schema.XmlSchema
The XmlSchema object removed from the XmlSchemaSet or null if the schema was not found in the XmlSchemaSet.

ExceptionCondition
XmlSchemaException

The schema is not a valid schema.

ArgumentNullException

The XmlSchema passed as a parameter is null.

Removing a schema from the XmlSchemaSet sets the IsCompiled property to false.

The following example illustrates adding multiple schemas to an XmlSchemaSet, then removing one of the schemas using the Remove method.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft