Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Remove Method

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)

'Declaration
Public Function Remove ( _
	schema As XmlSchema _
) As XmlSchema

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 Nothing 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 Nothing.

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.

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

.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

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show:
© 2015 Microsoft