/// <summary>
 /// Creates a Simple XML parser object.
 /// Call Go(BufferedReader) immediately after creation.
 /// </summary>
 private SimpleXmlParser(ISimpleXmlDocHandler doc, ISimpleXmlDocHandlerComment comment, bool html)
 {
     Doc          = doc;
     this.comment = comment;
     Html         = html;
     Stack        = new Stack();
     State        = html ? Text : Unknown;
 }
        /// <summary>
        /// Parses the XML document firing the events to the handler.
        /// @throws IOException on error
        /// </summary>
        /// <param name="doc">the document handler</param>
        /// <param name="comment"></param>
        /// <param name="r">the document. The encoding is already resolved. The reader is not closed</param>
        /// <param name="html"></param>
        public static void Parse(ISimpleXmlDocHandler doc, ISimpleXmlDocHandlerComment comment, TextReader r, bool html)
        {
            var parser = new SimpleXmlParser(doc, comment, html);

            parser.go(r);
        }