本文整理匯總了C#中System.Xml.Schema.XmlSchemaObjectCollection.Contains方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchemaObjectCollection.Contains方法的具體用法?C# XmlSchemaObjectCollection.Contains怎麽用?C# XmlSchemaObjectCollection.Contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.Schema.XmlSchemaObjectCollection
的用法示例。
在下文中一共展示了XmlSchemaObjectCollection.Contains方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddSubstElementRecursively
private void AddSubstElementRecursively (XmlSchemaObjectCollection col, XmlSchemaElement el)
{
if (el.SubstitutingElements != null)
for (int i = 0; i < el.SubstitutingElements.Count; i++)
this.AddSubstElementRecursively (col, el.SubstitutingElements [i] as XmlSchemaElement);
if (!col.Contains (el))
col.Add (el);
}
示例2: AddExternalComponentsTo
void AddExternalComponentsTo (XmlSchema s, XmlSchemaObjectCollection items, ValidationEventHandler handler, List<CompiledSchemaMemo> handledUris, XmlResolver resolver, XmlSchemaSet col)
{
foreach (XmlSchemaExternal ext in s.Includes)
s.ProcessExternal (handler, handledUris, resolver, ext, col);
foreach (XmlSchemaObject obj in s.compilationItems)
items.Add (obj);
// Items might be already resolved (recursive schema imports), or might not be (other cases), so we add items only when appropriate here. (duplicate check is anyways done elsewhere)
foreach (XmlSchemaObject obj in s.Items)
if (!items.Contains (obj))
items.Add (obj);
}
示例3: ValidateDerivationByRestriction
internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
if (this == baseParticle) // quick check
return true;
XmlSchemaElement el = baseParticle as XmlSchemaElement;
if (el != null) {
// Forbidden
if (raiseError)
error (h, "Invalid sequence paricle derivation.");
return false;
}
XmlSchemaSequence seq = baseParticle as XmlSchemaSequence;
if (seq != null) {
// Recurse
if (!ValidateOccurenceRangeOK (seq, h, schema, raiseError))
return false;
// If it is totally optional, then ignore their contents.
if (seq.ValidatedMinOccurs == 0 && seq.ValidatedMaxOccurs == 0 &&
this.ValidatedMinOccurs == 0 && this.ValidatedMaxOccurs == 0)
return true;
return ValidateRecurse (seq, h, schema, raiseError);
}
XmlSchemaAll all = baseParticle as XmlSchemaAll;
if (all != null) {
// RecurseUnordered
XmlSchemaObjectCollection already = new XmlSchemaObjectCollection ();
for (int i = 0; i < this.Items.Count; i++) {
XmlSchemaElement de = this.Items [i] as XmlSchemaElement;
if (de == null) {
if (raiseError)
error (h, "Invalid sequence particle derivation by restriction from all.");
return false;
}
foreach (XmlSchemaElement e in all.Items) {
if (e.QualifiedName == de.QualifiedName) {
if (already.Contains (e)) {
if (raiseError)
error (h, "Base element particle is mapped to the derived element particle in a sequence two or more times.");
return false;
} else {
already.Add (e);
if (!de.ValidateDerivationByRestriction (e, h, schema, raiseError))
return false;
}
}
}
}
foreach (XmlSchemaElement e in all.Items)
if (!already.Contains (e))
if (!e.ValidateIsEmptiable ()) {
if (raiseError)
error (h, "In base -all- particle, mapping-skipped base element which is not emptiable was found.");
return false;
}
return true;
}
XmlSchemaAny any = baseParticle as XmlSchemaAny;
if (any != null) {
// NSRecurseCheckCardinality
return ValidateNSRecurseCheckCardinality (any, h, schema, raiseError);
}
XmlSchemaChoice choice = baseParticle as XmlSchemaChoice;
if (choice != null) {
// MapAndSum
// In fact it is not Recurse, but it looks almost common.
return ValidateSeqRecurseMapSumCommon (choice, h, schema, false, true, raiseError);
}
return true;
}