/// <summary>
        /// Reset state used for parsing
        /// </summary>
        /// <param name="fullReset">clears incremental state as well</param>
        /// <remarks>Does not SyncLock, call inside lock</remarks>
        private void Init(string html)
        {
            if (this.htmlWriter == null)
            {
                this.htmlWriter = new HtmlWriter();
            }
            if (this.htmlFilter != null)
            {
                this.htmlFilter.HtmlWriter = this.htmlWriter;
            }

            // set up the source
            if (this.incrementalParsing && this.syncPoint >= 0)
            {
                // prepend remaining unparsed source
                html = this.source.Substring(this.syncPoint) + html;
            }
            this.source = (html == null) ? String.Empty : html;

            // reset indexes
            this.index = this.start = 0;

            if (!this.isInitialized)
            {
                // in incremental parse mode, continue as if same document
                this.textSize = 0;
                this.syncPoint = -1;
                this.openTags = new Stack<HtmlTag>(10);
                this.taxonomy = HtmlTaxonomy.None;
                this.isInitialized = true;
            }
        }
 private void RenderTag(HtmlTag tag)
 {
     try
     {
         if (this.htmlFilter == null || this.htmlFilter.FilterTag(tag))
         {
             this.htmlWriter.WriteTag(tag);
             this.taxonomy |= tag.Taxonomy;
         }
     }
     catch (Exception ex)
     {
         try { this.WriteLiteral("[ERROR: "+ex.Message+"]"); }
         catch { }
     }
 }