Ejemplo n.º 1
0
        /// <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());
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public bool IsMatch(Element e)
 {
     return(actualPredicate.IsMatch(e));
 }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
 /// <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();
 }
Ejemplo n.º 7
0
        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;
        }