private void EndElement() { XmlTextValue xmlTextValue; XmlDocumentParser.ElementScope elementScope; XmlDocumentParser.ElementScope elementScope1 = this.currentBranch.Pop(); XmlDocumentParser xmlDocumentParser = this; if (this.currentBranch.Count > 0) { elementScope = this.currentBranch.Peek(); } else { elementScope = null; } xmlDocumentParser.currentScope = elementScope; XmlElementParser parser = elementScope1.Parser; XmlElementValue xmlElementValue = parser.Parse(elementScope1.Element, elementScope1.ChildValues); if (xmlElementValue != null) { if (this.currentScope == null) { this.Result = xmlElementValue; } else { this.currentScope.AddChildValue(xmlElementValue); } } foreach (XmlAttributeInfo unused in elementScope1.Element.Attributes.Unused) { this.ReportUnexpectedAttribute(unused.Location, unused.Name); } IList <XmlElementValue> childValues = elementScope1.ChildValues; IEnumerable <XmlElementValue> xmlElementValues = childValues.Where <XmlElementValue>((XmlElementValue v) => v.IsText); IEnumerable <XmlElementValue> xmlElementValues1 = xmlElementValues; IEnumerable <XmlElementValue> xmlElementValues2 = xmlElementValues1.Where <XmlElementValue>((XmlElementValue t) => !t.IsUsed); if (xmlElementValues2.Any <XmlElementValue>()) { if (xmlElementValues2.Count <XmlElementValue>() != xmlElementValues.Count <XmlElementValue>()) { xmlTextValue = (XmlTextValue)xmlElementValues2.First <XmlElementValue>(); } else { xmlTextValue = (XmlTextValue)xmlElementValues.First <XmlElementValue>(); } this.ReportTextNotAllowed(xmlTextValue.Location, xmlTextValue.Value); } IList <XmlElementValue> childValues1 = elementScope1.ChildValues; foreach (XmlElementValue xmlElementValue1 in childValues1.Where <XmlElementValue>((XmlElementValue v) => { if (v.IsText) { return(false); } else { return(!v.IsUsed); } } )) { this.ReportUnusedElement(xmlElementValue1.Location, xmlElementValue1.Name); } }
private void BeginElement(XmlElementParser elementParser, XmlElementInfo element) { XmlDocumentParser.ElementScope elementScope = new XmlDocumentParser.ElementScope(elementParser, element); this.currentBranch.Push(elementScope); this.currentScope = elementScope; }