本文整理汇总了C#中System.Xml.Schema.XmlSchemaObjectCollection.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaObjectCollection.RemoveAt方法的具体用法?C# XmlSchemaObjectCollection.RemoveAt怎么用?C# XmlSchemaObjectCollection.RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaObjectCollection
的用法示例。
在下文中一共展示了XmlSchemaObjectCollection.RemoveAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveOptionalUnknownSerializationElements
void RemoveOptionalUnknownSerializationElements(XmlSchemaObjectCollection items)
{
for (int i = 0; i < items.Count; i++)
{
XmlSchemaElement element = items[i] as XmlSchemaElement;
if (element != null && element.RefName != null &&
element.RefName.Namespace == Globals.SerializationNamespace &&
element.MinOccurs == 0)
{
if (serializationSchemaElements == null)
{
XmlSchema serializationSchema = XmlSchema.Read(XmlReader.Create(new StringReader(Globals.SerializationSchema)), null);
serializationSchemaElements = new Hashtable();
foreach (XmlSchemaObject schemaObject in serializationSchema.Items)
{
XmlSchemaElement schemaElement = schemaObject as XmlSchemaElement;
if (schemaElement != null)
serializationSchemaElements.Add(schemaElement.Name, schemaElement);
}
}
if (!serializationSchemaElements.ContainsKey(element.RefName.Name))
{
items.RemoveAt(i);
i--;
}
}
}
}
示例2: RemoveOptionalUnknownSerializationElements
private void RemoveOptionalUnknownSerializationElements(XmlSchemaObjectCollection items)
{
for (int i = 0; i < items.Count; i++)
{
XmlSchemaElement element = items[i] as XmlSchemaElement;
if (((element != null) && (element.RefName != null)) && ((element.RefName.Namespace == "http://schemas.microsoft.com/2003/10/Serialization/") && (element.MinOccurs == 0M)))
{
if (serializationSchemaElements == null)
{
XmlSchema schema = XmlSchema.Read(XmlReader.Create(new StringReader("<?xml version='1.0' encoding='utf-8'?>\r\n<xs:schema elementFormDefault='qualified' attributeFormDefault='qualified' xmlns:tns='http://schemas.microsoft.com/2003/10/Serialization/' targetNamespace='http://schemas.microsoft.com/2003/10/Serialization/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>\r\n <xs:element name='anyType' nillable='true' type='xs:anyType' />\r\n <xs:element name='anyURI' nillable='true' type='xs:anyURI' />\r\n <xs:element name='base64Binary' nillable='true' type='xs:base64Binary' />\r\n <xs:element name='boolean' nillable='true' type='xs:boolean' />\r\n <xs:element name='byte' nillable='true' type='xs:byte' />\r\n <xs:element name='dateTime' nillable='true' type='xs:dateTime' />\r\n <xs:element name='decimal' nillable='true' type='xs:decimal' />\r\n <xs:element name='double' nillable='true' type='xs:double' />\r\n <xs:element name='float' nillable='true' type='xs:float' />\r\n <xs:element name='int' nillable='true' type='xs:int' />\r\n <xs:element name='long' nillable='true' type='xs:long' />\r\n <xs:element name='QName' nillable='true' type='xs:QName' />\r\n <xs:element name='short' nillable='true' type='xs:short' />\r\n <xs:element name='string' nillable='true' type='xs:string' />\r\n <xs:element name='unsignedByte' nillable='true' type='xs:unsignedByte' />\r\n <xs:element name='unsignedInt' nillable='true' type='xs:unsignedInt' />\r\n <xs:element name='unsignedLong' nillable='true' type='xs:unsignedLong' />\r\n <xs:element name='unsignedShort' nillable='true' type='xs:unsignedShort' />\r\n <xs:element name='char' nillable='true' type='tns:char' />\r\n <xs:simpleType name='char'>\r\n <xs:restriction base='xs:int'/>\r\n </xs:simpleType> \r\n <xs:element name='duration' nillable='true' type='tns:duration' />\r\n <xs:simpleType name='duration'>\r\n <xs:restriction base='xs:duration'>\r\n <xs:pattern value='\\-?P(\\d*D)?(T(\\d*H)?(\\d*M)?(\\d*(\\.\\d*)?S)?)?' />\r\n <xs:minInclusive value='-P10675199DT2H48M5.4775808S' />\r\n <xs:maxInclusive value='P10675199DT2H48M5.4775807S' />\r\n </xs:restriction>\r\n </xs:simpleType>\r\n <xs:element name='guid' nillable='true' type='tns:guid' />\r\n <xs:simpleType name='guid'>\r\n <xs:restriction base='xs:string'>\r\n <xs:pattern value='[\\da-fA-F]{8}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{12}' />\r\n </xs:restriction>\r\n </xs:simpleType>\r\n <xs:attribute name='FactoryType' type='xs:QName' />\r\n <xs:attribute name='Id' type='xs:ID' />\r\n <xs:attribute name='Ref' type='xs:IDREF' />\r\n</xs:schema>\r\n")), null);
serializationSchemaElements = new Hashtable();
foreach (XmlSchemaElement element2 in schema.Items)
{
if (element2 != null)
{
serializationSchemaElements.Add(element2.Name, element2);
}
}
}
if (!serializationSchemaElements.ContainsKey(element.RefName.Name))
{
items.RemoveAt(i);
i--;
}
}
}
}