XmlSchemaSet.Remove Method

Note: This method is new in the .NET Framework version 2.0.

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
)
public XmlSchema Remove (
	XmlSchema schema
)
public function Remove (
	schema : XmlSchema
) : XmlSchema

Parameters

schema

The XmlSchema object to remove from the XmlSchemaSet.

Return Value

The XmlSchema object removed from the XmlSchemaSet or a null reference (Nothing in Visual Basic) if the schema was not found in the XmlSchemaSet.

Exception typeCondition

XmlSchemaException

The schema is not a valid schema.

ArgumentNullException

The XmlSchema passed as a parameter is a null reference (Nothing in Visual Basic).

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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show: