本文整理汇总了C#中System.Xml.Schema.XmlSchemaAnyAttribute.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAnyAttribute.Validate方法的具体用法?C# XmlSchemaAnyAttribute.Validate怎么用?C# XmlSchemaAnyAttribute.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaAnyAttribute
的用法示例。
在下文中一共展示了XmlSchemaAnyAttribute.Validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateAttributesResolved
public static int ValidateAttributesResolved (
XmlSchemaObjectTable attributesResolved,
ValidationEventHandler h,
XmlSchema schema,
XmlSchemaObjectCollection attributes,
XmlSchemaAnyAttribute anyAttribute,
ref XmlSchemaAnyAttribute anyAttributeUse,
XmlSchemaAttributeGroup redefined,
bool skipEquivalent)
{
int errorCount = 0;
if (anyAttribute != null && anyAttributeUse == null)
anyAttributeUse = anyAttribute;
ArrayList newAttrNames = new ArrayList ();
foreach (XmlSchemaObject xsobj in attributes) {
XmlSchemaAttributeGroupRef grpRef = xsobj as XmlSchemaAttributeGroupRef;
if (grpRef != null) {
// Resolve attributeGroup redefinition.
XmlSchemaAttributeGroup grp = null;
if (redefined != null && grpRef.RefName == redefined.QualifiedName)
grp = redefined;
else
grp = schema.FindAttributeGroup (grpRef.RefName);
// otherwise, it might be missing sub components.
if (grp == null) {
if (!schema.missedSubComponents)// && schema.Schemas [grpRef.RefName.Namespace] != null)
grpRef.error (h, "Referenced attribute group " + grpRef.RefName + " was not found in the corresponding schema.");
continue;
}
if (grp.AttributeGroupRecursionCheck) {
grp.error (h, "Attribute group recursion was found: " + grpRef.RefName);
continue;
}
try {
grp.AttributeGroupRecursionCheck = true;
errorCount += grp.Validate (h, schema);
} finally {
grp.AttributeGroupRecursionCheck = false;
}
if (grp.AnyAttributeUse != null) {
if (anyAttribute == null)
anyAttributeUse = grp.AnyAttributeUse;
}
foreach (DictionaryEntry entry in grp.AttributeUses) {
XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
if (StrictMsCompliant && attr.Use == XmlSchemaUse.Prohibited)
continue;
if (attr.RefName != null && attr.RefName != XmlQualifiedName.Empty && (!skipEquivalent || !AreAttributesEqual (attr, attributesResolved [attr.RefName] as XmlSchemaAttribute)))
AddToTable (attributesResolved, attr, attr.RefName, h);
else if (!skipEquivalent || !AreAttributesEqual (attr, attributesResolved [attr.QualifiedName] as XmlSchemaAttribute))
AddToTable (attributesResolved, attr, attr.QualifiedName, h);
}
} else {
XmlSchemaAttribute attr = xsobj as XmlSchemaAttribute;
if (attr != null) {
errorCount += attr.Validate (h, schema);
if (newAttrNames.Contains (attr.QualifiedName))
attr.error (h, String.Format ("Duplicate attributes was found for '{0}'", attr.QualifiedName));
newAttrNames.Add (attr.QualifiedName);
if (StrictMsCompliant && attr.Use == XmlSchemaUse.Prohibited)
continue;
if (attr.RefName != null && attr.RefName != XmlQualifiedName.Empty && (!skipEquivalent || !AreAttributesEqual (attr, attributesResolved [attr.RefName] as XmlSchemaAttribute)))
AddToTable (attributesResolved, attr, attr.RefName, h);
else if (!skipEquivalent || !AreAttributesEqual (attr, attributesResolved [attr.QualifiedName] as XmlSchemaAttribute))
AddToTable (attributesResolved, attr, attr.QualifiedName, h);
} else {
if (anyAttribute != null) {
anyAttributeUse = (XmlSchemaAnyAttribute) xsobj;
anyAttribute.Validate (h, schema);
}
}
}
}
return errorCount;
}