public XmlValidator(XmlStruct xmlStruct) { this.xmlStruct = xmlStruct; }
private void readElement(XmlStruct xmlStruct, XmlTextReader reader, XmlTag element) { /* If the stack is emepty, push only the root tag */ if (stack.Count == 0 && element.Tag == xmlStruct.Root.Tag) { stack.Push(element); readAttribute(xmlStruct.Root, reader, element); } else if (stack.Count > 0 && readChildren(stack.Peek(), reader, element)) // else push, if the tag is a child of the stack.Peek(). { stack.Push(element); readAttribute(stack.Peek(), reader, element); } else throw new Exception("Error 5: Invalid Tag '" + element.Tag + "'. " + "Line " + reader.LineNumber + ", position " + reader.LinePosition); }