Ejemplo n.º 1
0
 /// <summary>
 /// Get the descendants elements of the element with a selector
 /// </summary>
 public static IEnumerable <HElement> Find(this HContainer element, String selector)
 {
     if (element != null)
     {
         return(element.Descendants(selector));
     }
     return(Enumerable.Empty <HElement>());
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get the children elements of the element with a selector
 /// </summary>
 public static IEnumerable <HElement> Children(this HContainer element, String selector)
 {
     if (element != null)
     {
         return(element.Elements(selector));
     }
     return(Enumerable.Empty <HElement>());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Reduce the set of matched elements
 /// </summary>
 public static IEnumerable <HElement> Filter(this HContainer element, Func <int, HElement, bool> selection)
 {
     if (element != null)
     {
         return(element.Descendants().Filter(selection));
     }
     return(Enumerable.Empty <HElement>());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Remove elements from the set of elements
 /// </summary>
 public static IEnumerable <HElement> Not(this HContainer element, IEnumerable <HElement> selection)
 {
     if (element != null)
     {
         return(element.Descendants().Not(selection));
     }
     return(Enumerable.Empty <HElement>());
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Enumerate all parents
        /// </summary>
        protected IEnumerable <HElement> GetParents(String name)
        {
            HContainer p = parent;

            while (p != null)
            {
                HElement e = p as HElement;
                if (e != null && (name == null || String.Equals(e.Name, name, StringComparison.OrdinalIgnoreCase)))
                {
                    yield return(e);
                }
                p = p.parent;
            }
        }
Ejemplo n.º 6
0
 internal HContainer(HContainer other)
 {
     if (other.content is string)
     {
         this.content = other.content;
     }
     else
     {
         HNode n = (HNode)other.content;
         if (n != null)
         {
             do
             {
                 n = n.nextNode;
                 AppendNode(n.CloneNode());
             } while (n != other.content);
         }
     }
 }