XmlSchemaSet.RemoveRecursive(XmlSchema) 메서드

정의

지정된 XSD(XML 스키마 정의 언어) 스키마와 해당 스키마에 가져온 모든 스키마를 XmlSchemaSet에서 제거합니다.

public:
 bool RemoveRecursive(System::Xml::Schema::XmlSchema ^ schemaToRemove);
public bool RemoveRecursive (System.Xml.Schema.XmlSchema schemaToRemove);
member this.RemoveRecursive : System.Xml.Schema.XmlSchema -> bool
Public Function RemoveRecursive (schemaToRemove As XmlSchema) As Boolean

매개 변수

schemaToRemove
XmlSchema

XmlSchema에서 제거할 XmlSchemaSet 개체입니다.

반환

Boolean

XmlSchema 개체와 해당 개체에 가져온 모든 항목이 제거되었으면 true이고, 그렇지 않으면 false입니다.

예외

매개 변수로 전달된 XmlSchemanull인 경우

예제

다음 코드 예제에서는 여러 스키마를 추가한 XmlSchemaSet다음, 메서드를 사용하여 RemoveRecursive 가져오는 스키마와 모든 스키마 중 하나를 제거하는 방법을 보여 줍니다.

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.RemoveRecursive(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.RemoveRecursive(schema);  
    }  
}  

설명

이 메서드는 RemoveRecursive 스키마 또는 가져온 스키 XmlSchemaSet마에 대한 종속성이 없는 한 지정된 스키마와 가져온 모든 스키마를 제거합니다. 스키마 또는 가져온 스키마에 대한 종속성이 있는 XmlSchemaSet경우 아무것도 제거되지 않으며 RemoveRecursive 반환 false됩니다. 반환되고 정의된 ValidationEventHandler 경우 false 종속성을 설명하는 경고가 이벤트 처리기로 전송됩니다.

지정된 스키마가 다른 스키마를 가져오고 지정된 스키마를 메서드 RemoveRecursive 와 함께 Remove 이전에 제거한 경우 메서드는 가져온 스키마를 제거하지 않고 반환false합니다. 예를 들어 가져오기 childSchema1 및 다음 코드가 제거되는 경우 parentSchema 가져온 childSchema1 스키마와 childSchema2 스키마는 제거parentSchema하지 childSchema2 않습니다.

XmlSchemaSet ss = new XmlSchemaSet();  
XmlSchema xs = XmlSchema.Read(XmlReader.Create("parentSchema.xsd"), null);  
ss.Add(xs);  
ss.Compile();  
ss.Remove(xs);  
ss.Compile();  
ss.RemoveRecursive(xs);  
ss.Compile();  

다음 코드는 가져온 스키마와 가져온 스키마를 제거 parentSchema 합니다.

XmlSchemaSet ss = new XmlSchemaSet();  
XmlSchema xs = XmlSchema.Read(XmlReader.Create("parentSchema.xsd"), null);  
ss.Add(xs);  
ss.Compile();  
ss.RemoveRecursive(xs);  
ss.Compile();  

메서드 RemoveRecursive 는 속성의 IsCompiled 상태에 영향을 주지 않습니다.

적용 대상