當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlSchema.FindAttributeGroup方法代碼示例

本文整理匯總了C#中System.Xml.Schema.XmlSchema.FindAttributeGroup方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlSchema.FindAttributeGroup方法的具體用法?C# XmlSchema.FindAttributeGroup怎麽用?C# XmlSchema.FindAttributeGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Schema.XmlSchema的用法示例。


在下文中一共展示了XmlSchema.FindAttributeGroup方法的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;
		}
開發者ID:carrie901,項目名稱:mono,代碼行數:83,代碼來源:XmlSchemaUtil.cs


注:本文中的System.Xml.Schema.XmlSchema.FindAttributeGroup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。