/// <summary>
        /// Does not do tag balancing.
        /// </summary>
        public string CollectHtmlUntilPredicate(IElementPredicate elementp)
        {
            StringBuilder result = new StringBuilder();
            Element       el;

            while (null != (el = Next()))
            {
                if (elementp.IsMatch(el))
                {
                    break;
                }
                result.Append(html, el.Offset, el.Length);
            }
            return(result.ToString());
        }
        public HtmlExtractor MatchNext(IElementPredicate predicate, bool ignoreWhitespace)
        {
            lastMatch = null;

            Element e;

            do
            {
                e = parser.Next();
            }while (e != null && ignoreWhitespace && IsWhitespaceOrZeroLengthText(e));

            if (e != null && predicate.IsMatch(e))
            {
                lastMatch = e;
            }

            return(this);
        }
        public HtmlExtractor SeekWithin(IElementPredicate predicate, IElementPredicate withinPredicate)
        {
            lastMatch = null;

            Element e;

            while (null != (e = parser.Next()))
            {
                if (predicate.IsMatch(e))
                {
                    lastMatch = e;
                    break;
                }
                if (withinPredicate != null && withinPredicate.IsMatch(e))
                {
                    break;
                }
            }

            return(this);
        }
 public bool IsMatch(Element e)
 {
     return(actualPredicate.IsMatch(e));
 }
        public HtmlExtractor SeekWithin(IElementPredicate predicate, IElementPredicate withinPredicate)
        {
            lastMatch = null;

            Element e;
            while (null != (e = parser.Next()))
            {
                if (predicate.IsMatch(e))
                {
                    lastMatch = e;
                    break;
                }
                if (withinPredicate != null && withinPredicate.IsMatch(e))
                    break;
            }

            return this;
        }
 /// <summary>
 /// Does not do tag balancing.
 /// </summary>
 public string CollectHtmlUntilPredicate(IElementPredicate elementp)
 {
     StringBuilder result = new StringBuilder();
     Element el;
     while (null != (el = Next()))
     {
         if (elementp.IsMatch(el))
             break;
         result.Append(html, el.Offset, el.Length);
     }
     return result.ToString();
 }
        public HtmlExtractor MatchNext(IElementPredicate predicate, bool ignoreWhitespace)
        {
            lastMatch = null;

            Element e;
            do
            {
                e = parser.Next();
            }
            while (e != null && ignoreWhitespace && IsWhitespaceOrZeroLengthText(e));

            if (e != null && predicate.IsMatch(e))
                lastMatch = e;

            return this;
        }