Mono.Xml.DTDValidatingReader.VerifyDeclaredAttributes C# (CSharp) Method

VerifyDeclaredAttributes() public method

public VerifyDeclaredAttributes ( DTDAttListDeclaration decl ) : void
decl DTDAttListDeclaration
return void
		void VerifyDeclaredAttributes (DTDAttListDeclaration decl)
		{
			// Check if all required attributes exist, and/or
			// if there is default values, then add them.
			for (int i = 0; i < decl.Definitions.Count; i++) {
				DTDAttributeDefinition def = (DTDAttributeDefinition) decl.Definitions [i];
				bool exists = false;
				for (int a = 0; a < attributeCount; a++) {
					if (attributes [a].Name == def.Name) {
						exists = true;
						break;
					}
				}
				if (exists)
					continue;

				if (def.OccurenceType == DTDAttributeOccurenceType.Required) {
					HandleError (String.Format ("Required attribute {0} in element {1} not found .",
						def.Name, decl.Name),
						XmlSeverityType.Error);
					continue;
				}

				else if (def.DefaultValue == null)
					continue;

				if (this.isStandalone && !def.IsInternalSubset)
					HandleError ("In standalone document, external default value definition must not be applied.", XmlSeverityType.Error);

				switch (validatingReader.ValidationType) {
				case ValidationType.Auto:
					if (validatingReader.Schemas.Count == 0)
						goto case ValidationType.DTD;
					break;
				case ValidationType.DTD:
				case ValidationType.None:
					// Other than them, ignore DTD defaults.
					AttributeSlot slot = GetAttributeSlot ();
					slot.Name = def.Name;
					int colonAt = def.Name.IndexOf (':');
					slot.LocalName = colonAt < 0 ? def.Name :
						def.Name.Substring (colonAt + 1);
					string prefix = colonAt < 0 ?
						String.Empty :
						def.Name.Substring (0, colonAt);
					slot.Prefix = prefix;
					slot.Value = def.DefaultValue;
					slot.IsDefault = true;
					break;
				}
			}
		}