本文整理汇总了C#中System.Xml.Schema.XmlSchemaSet.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaSet.Remove方法的具体用法?C# XmlSchemaSet.Remove怎么用?C# XmlSchemaSet.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaSet
的用法示例。
在下文中一共展示了XmlSchemaSet.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: v3
//[Variation(Desc = "v3 - Contains with existing schema, Remove it, Contains again")]
public void v3()
{
XmlSchemaSet sc = new XmlSchemaSet();
XmlSchema Schema = sc.Add("xsdauthor", TestData._XsdAuthor);
Assert.Equal(sc.Contains("xsdauthor"), true);
sc.Remove(Schema);
Assert.Equal(sc.Contains("xsdauthor"), false);
return;
}
示例2: v3
public void v3()
{
XmlSchemaSet sc = new XmlSchemaSet();
sc.Add("xsdauthor1", TestData._XsdNoNs);
XmlSchema Schema1 = sc.Add("xsdauthor", TestData._XsdAuthor);
sc.Compile();
sc.Remove(Schema1);
CError.Compare(sc.IsCompiled, false, "IsCompiled after compiled and remove");
return;
}
示例3: v1
public void v1()
{
try
{
XmlSchemaSet sc = new XmlSchemaSet();
sc.Remove(null);
}
catch (ArgumentNullException)
{
// GLOBALIZATION
return;
}
Assert.True(false);
}
示例4: v2
public void v2()
{
XmlSchemaSet sc = new XmlSchemaSet();
sc.XmlResolver = new XmlUrlResolver();
XmlSchema Schema1 = sc.Add(null, TestData._XsdAuthor);
sc.Compile();
sc.Remove(Schema1);
CError.Compare(sc.Count, 0, "Count");
ICollection Col = sc.Schemas();
CError.Compare(Col.Count, 0, "ICollection.Count");
return;
}
示例5: v3
public void v3()
{
XmlSchemaSet sc = new XmlSchemaSet();
sc.XmlResolver = new XmlUrlResolver();
XmlSchema Schema1 = sc.Add(null, TestData._XsdAuthor);
XmlSchema Schema2 = sc.Add("test", TestData._XsdNoNs);
sc.Compile();
sc.Remove(Schema1);
CError.Compare(sc.Count, 1, "Count");
ICollection Col = sc.Schemas();
CError.Compare(Col.Count, 1, "ICollection.Count");
CError.Compare(sc.Contains("test"), true, "Contains");
return;
}
示例6: v3
//[Variation(Desc = "v3 - Contains with existing schema, Remove it, Contains again", Priority = 0)]
public void v3()
{
XmlSchemaSet sc = new XmlSchemaSet();
#pragma warning disable 0618
XmlSchemaCollection scl = new XmlSchemaCollection();
#pragma warning restore 0618
XmlSchema Schema = scl.Add(null, TestData._XsdAuthor);
sc.Add(Schema);
Assert.Equal(sc.Contains(Schema), true);
sc.Remove(Schema);
Assert.Equal(sc.Contains(Schema), false);
return;
}
示例7: RemoveDuplicates
/// <summary>
/// Removes the duplicate schemas in a given XmlSchemaSet instance.
/// </summary>
private static void RemoveDuplicates(ref XmlSchemaSet set)
{
ArrayList schemalist = new ArrayList(set.Schemas());
ArrayList duplicatedschemalist = new ArrayList();
for (int schemaindex = 0; schemaindex < schemalist.Count; schemaindex++)
{
if (((XmlSchema)schemalist[schemaindex]).SourceUri == string.Empty)
{
duplicatedschemalist.Add(schemalist[schemaindex]);
}
else
{
for (int lowerschemaindex = schemaindex + 1; lowerschemaindex < schemalist.Count; lowerschemaindex++)
{
if (((XmlSchema)schemalist[lowerschemaindex]).SourceUri == ((XmlSchema)schemalist[schemaindex]).SourceUri)
{
duplicatedschemalist.Add(schemalist[lowerschemaindex]);
}
}
}
}
foreach (XmlSchema schema in duplicatedschemalist)
{
set.Remove(schema);
}
}
示例8: v28
public void v28()
{
string xmlns = @"http://www.w3.org/XML/1998/namespace";
XmlSchema schema = null;
XmlSchemaSet ss = new XmlSchemaSet();
ss.XmlResolver = new XmlUrlResolver();
ss.Add(null, Path.Combine(TestData._Root, "bug338038_v3.xsd"));
ss.Compile();
foreach (XmlSchema s in ss.Schemas(xmlns))
{
schema = s;
}
ss.Add(null, Path.Combine(TestData._Root, "bug338038_v4a.xsd"));
ss.Compile();
ss.Add(null, Path.Combine(TestData._Root, "bug338038_v5b.xsd"));
ss.Compile();
ss.Remove(schema);
ss.Compile();
foreach (XmlSchemaAttribute a in ss.GlobalAttributes.Values)
{
if (a.QualifiedName.Name == "blah")
{
CError.Compare(a.AttributeSchemaType.QualifiedName.Name, "int", "Incorrect type for xml:lang");
}
}
CError.Compare(ss.Count, 5, "Count of SchemaSet not matched!");
return;
}
示例9: v3
public void v3(object param0, object param1, object param2, object param3, object param4, object param5, object param6)
{
string ns1 = param0.ToString();
string ns2 = param3.ToString();
string a1 = param1.ToString();
string a2 = param2.ToString();
string a3 = param4.ToString();
string a4 = param5.ToString();
bool doCompile = (bool)param6;
XmlSchema s1 = GetSchema(ns1, a1, a2);
XmlSchema s2 = GetSchema(ns2, a3, a4);
XmlSchemaSet ss1 = new XmlSchemaSet();
XmlSchemaSet ss2 = new XmlSchemaSet();
ss1.Add(s1);
ss1.Compile();
ss2.Add(s2);
if (doCompile)
ss2.Compile();
// add one schemaset to another
ss1.Add(ss2);
if (!doCompile)
ss1.Compile();
//Verify
CError.Compare(ss1.GlobalAttributes.Count, 4, "Types Count after add");
CError.Compare(ss1.GlobalAttributes.Contains(new XmlQualifiedName(a1, ns1)), true, "Contains1");
CError.Compare(ss1.GlobalAttributes.Contains(new XmlQualifiedName(a2, ns1)), true, "Contains2");
CError.Compare(ss1.GlobalAttributes.Contains(new XmlQualifiedName(a3, ns2)), true, "Contains3");
CError.Compare(ss1.GlobalAttributes.Contains(new XmlQualifiedName(a4, ns2)), true, "Contains4");
//Now reprocess one schema and check
ss1.Reprocess(s1);
ss1.Compile();
CError.Compare(ss1.GlobalAttributes.Count, 4, "Types Count after reprocess");
//Now Remove one schema and check
ss1.Remove(s1);
CError.Compare(ss1.GlobalAttributes.Count, 2, "Types Count after repr/remove"); // count should still be 4
ss1.Compile();
CError.Compare(ss1.GlobalAttributes.Count, 2, "Types Count after repr/remove/comp"); // count should NOW still be 2
return;
}
示例10: v2
public void v2(object param0, object param1, object param2, object param3, object param4, object param5)
{
string ns1 = param0.ToString();
string ns2 = param3.ToString();
string a1 = param1.ToString();
string a2 = param2.ToString();
string a3 = param4.ToString();
string a4 = param5.ToString();
XmlSchema s1 = GetSchema(ns1, a1, a2);
XmlSchema s2 = GetSchema(ns2, a3, a4);
XmlSchemaSet ss = new XmlSchemaSet();
ss.Add(s1);
ss.Compile();
ss.Add(s2);
CError.Compare(ss.GlobalAttributes.Count, 2, "Elements Countafter add"); //+1 for anyType
ss.Compile();
//Verify
CError.Compare(ss.GlobalAttributes.Count, 4, "Elements Count after add/compile");
CError.Compare(ss.GlobalAttributes.Contains(new XmlQualifiedName(a1, ns1)), true, "Contains1");
CError.Compare(ss.GlobalAttributes.Contains(new XmlQualifiedName(a2, ns1)), true, "Contains2");
CError.Compare(ss.GlobalAttributes.Contains(new XmlQualifiedName(a3, ns2)), true, "Contains3");
CError.Compare(ss.GlobalAttributes.Contains(new XmlQualifiedName(a4, ns2)), true, "Contains4");
//Now reprocess one schema and check
ss.Reprocess(s1);
ss.Compile();
CError.Compare(ss.GlobalAttributes.Count, 4, "Elements Count after reprocess");
//Now Remove one schema and check
ss.Remove(s1);
CError.Compare(ss.GlobalAttributes.Count, 2, "Elements Count after remove no compile");
ss.Compile();
CError.Compare(ss.GlobalAttributes.Count, 2, "Elements Count adter remove and compile");
return;
}
示例11: XmlSchemaSet
public void XmlSchemaSetCompileAfterRemovingLastSchemaInTheSetIsNotClearingCachedCompiledInformationUsedForValidation_2()
{
string schemaXml = @"<Schema:schema xmlns:Schema='http://www.w3.org/2001/XMLSchema' targetNamespace='uri1'>
<Schema:element name='doc' type='Schema:string'/>
</Schema:schema>";
string instanceXml = @"<doc xmlns='uri1'>some</doc>";
XmlSchemaSet ss = new XmlSchemaSet(new NameTable());
XmlSchema schema = XmlSchema.Read(new StringReader(schemaXml), null);
ss.Add(schema);
Assert.Equal(ss.Count, 1);
ss.Compile();
Assert.Equal(ss.Count, 1);
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas = ss;
settings.ValidationType = ValidationType.Schema;
using (XmlReader xmlReader = XmlReader.Create(new StringReader(instanceXml), settings))
{
while (xmlReader.Read()) ;
}
XmlSchema removedSchema = ss.Remove(schema);
Assert.Equal(ss.Count, 0);
ss.Compile();
Assert.Equal(ss.Count, 0);
settings = new XmlReaderSettings();
settings.Schemas = ss;
settings.ValidationType = ValidationType.Schema;
using (XmlReader xmlReader = XmlReader.Create(new StringReader(instanceXml), settings))
{
while (xmlReader.Read()) ;
}
return;
}
示例12: v4
public void v4()
{
XmlSchemaSet sc = new XmlSchemaSet();
XmlSchema Schema1 = sc.Add("xsdauthor1", TestData._XsdNoNs);
XmlSchema Schema2 = sc.Add("xsdauthor", TestData._XsdAuthor);
ICollection Col = sc.Schemas();
sc.Remove(Schema1);
CError.Compare(Col.Count, 1, "Count");
foreach (XmlSchema Schema in Col)
{
CError.Compare(Schema, Schema2, "Schema");
}
return;
}
示例13: v6
public void v6()
{
XmlSchemaSet sc = new XmlSchemaSet();
XmlSchema Schema2 = sc.Add(null, TestData._XsdAuthor);
sc.Remove(Schema2);
ICollection Col = sc.Schemas("xsdauthor");
CError.Compare(Col.Count, 0, "Count");
foreach (XmlSchema Schema in Col)
{
XmlSchema a = Schema;
_output.WriteLine("should never enter this loop");
Assert.True(false);
}
return;
}
示例14: v20
public void v20()
{
XmlSchemaSet sc = new XmlSchemaSet();
sc.XmlResolver = new XmlUrlResolver();
XmlSchema Schema = sc.Add(null, TestData._XsdAuthor); // param as filename
sc.Compile();
CError.Compare(sc.Count, 1, "Count before remove");
sc.Remove(Schema);
sc.Compile();
CError.Compare(sc.Count, 0, "Count after remove");
CError.Compare(sc.GlobalElements.Count, 0, "GlobalElems Count");
return;
}
示例15: v2
public void v2(object param0, object param1, object param2, object param3, object param4, object param5)
{
string ns1 = param0.ToString();
string ns2 = param3.ToString();
string type1 = param1.ToString();
string type2 = param2.ToString();
string type3 = param4.ToString();
string type4 = param5.ToString();
XmlSchema s1 = GetSchema(ns1, type1, type2);
XmlSchema s2 = GetSchema(ns2, type3, type4);
XmlSchemaSet ss = new XmlSchemaSet();
ss.Add(s1);
CError.Compare(ss.GlobalTypes.Count, 0, "Types Count after add");
ss.Compile();
ss.Add(s2);
CError.Compare(ss.GlobalTypes.Count, 3, "Types Count after add/compile"); //+1 for anyType
ss.Compile();
//Verify
CError.Compare(ss.GlobalTypes.Count, 5, "Types Count after add/compile/add/compile"); //+1 for anyType
CError.Compare(ss.GlobalTypes.Contains(new XmlQualifiedName(type1, ns1)), true, "Contains1");
CError.Compare(ss.GlobalTypes.Contains(new XmlQualifiedName(type2, ns1)), true, "Contains2");
CError.Compare(ss.GlobalTypes.Contains(new XmlQualifiedName(type3, ns2)), true, "Contains3");
CError.Compare(ss.GlobalTypes.Contains(new XmlQualifiedName(type4, ns2)), true, "Contains4");
//Now reprocess one schema and check
ss.Reprocess(s1);
CError.Compare(ss.GlobalTypes.Count, 3, "Types Count after repr"); //+1 for anyType
ss.Compile();
CError.Compare(ss.GlobalTypes.Count, 5, "Types Count after repr/comp"); //+1 for anyType
//Now Remove one schema and check
ss.Remove(s1);
CError.Compare(ss.GlobalTypes.Count, 3, "Types Count after remove");
ss.Compile();
CError.Compare(ss.GlobalTypes.Count, 3, "Types Count after remove/comp");
return;
}