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

ProcessStartElement() public method

public ProcessStartElement ( ) : void
return void
		void ProcessStartElement ()
		{
			nsmgr.PushScope ();
			popScope = reader.IsEmptyElement;
			elementStack.Push (reader.Name);

			currentElement = Name;

			// If no DTD, skip validation.
			if (currentAutomata == null) {
				ValidateAttributes (null, false);
				if (reader.IsEmptyElement)
					ProcessEndElement ();
				return;
			}

			// StartElementDeriv

			previousAutomata = currentAutomata;
			currentAutomata = currentAutomata.TryStartElement (reader.Name);
			if (currentAutomata == DTD.Invalid) {
				HandleError (String.Format ("Invalid start element found: {0}", reader.Name),
					XmlSeverityType.Error);
				currentAutomata = previousAutomata;
			}

			DTDElementDeclaration elem =
				DTD.ElementDecls [reader.Name];
			if (elem == null) {
				HandleError (String.Format ("Element {0} is not declared.", reader.Name),
					XmlSeverityType.Error);
				currentAutomata = previousAutomata;
			}

			automataStack.Push (currentAutomata);
			if (elem != null)	// i.e. not invalid
				currentAutomata = elem.ContentModel.GetAutomata ();

			DTDAttListDeclaration attList = dtd.AttListDecls [currentElement];
			if (attList != null) {
				// check attributes
				ValidateAttributes (attList, true);
				currentAttribute = -1;
			} else {
				if (reader.HasAttributes) {
					HandleError (String.Format (
						"Attributes are found on element {0} while it has no attribute definitions.", currentElement),
						XmlSeverityType.Error);
				}
				// SetupValidityIgnorantAttributes ();
				ValidateAttributes (null, false);
			}
			// If it is empty element then directly check end element.
			if (reader.IsEmptyElement)
				ProcessEndElement ();
		}