Exemple #1
0
 /// <summary>
 /// Gets the last attribute of child node that have attribute by given name and value of this element.
 /// </summary>
 /// <param name="elementName">Use wildcards(*) to search in all elements</param>
 public static HtmlAgilityPack.HtmlAttribute SelectLastChildAttribute(this HtmlAgilityPack.HtmlNode source, string elementName, string attributeName, string attributeValue)
 {
     return(source.ChildrenSelector(elementName).FirstOrDefault(s => s.HasAttribute(attributeName, attributeValue))?.Attributes[attributeName]);
 }
Exemple #2
0
 /// <summary>
 /// Gets the last child node that have attribute by given name of this element.
 /// </summary>
 /// <param name="elementName">Use wildcards(*) to search in all elements</param>
 public static HtmlAgilityPack.HtmlNode SelectLastChild(this HtmlAgilityPack.HtmlNode source, string elementName, string attributeName)
 {
     return(source.ChildrenSelector(elementName).LastOrDefault(s => s.HasAttribute(attributeName)));
 }
Exemple #3
0
 /// <summary>
 /// Gets the first child node by given name of this element.
 /// </summary>
 public static HtmlAgilityPack.HtmlNode SelectFirstChild(this HtmlAgilityPack.HtmlNode source, string elementName)
 {
     return(source.ChildrenSelector(elementName).FirstOrDefault());
 }
Exemple #4
0
 /// <summary>
 /// Gets the collection of attributes of matching elements.
 /// </summary>
 /// <param name="elementName">Use wildcards(*) to match all elements</param>
 public static IEnumerable <HtmlAgilityPack.HtmlAttribute> SelectChildrenAttributes(this HtmlAgilityPack.HtmlNode source, string elementName, string attributeName, string attributeValue)
 {
     return(source.ChildrenSelector(elementName).Where(w => w.HasAttribute(attributeName, attributeValue)).Select(s => s.Attributes[attributeName]));
 }
Exemple #5
0
 /// <summary>
 /// Returns a collection of all children nodes that have attribute by given name of this element.
 /// </summary>
 /// <param name="elementName">Use wildcards(*) to match all elements</param>
 public static IEnumerable <HtmlAgilityPack.HtmlNode> SelectChildren(this HtmlAgilityPack.HtmlNode source, string elementName, string attributeName)
 {
     return(source.ChildrenSelector(elementName).Where(w => w.HasAttribute(attributeName)));
 }
Exemple #6
0
 /// <summary>
 /// Returns a collection of all children nodes by given name of this element.
 /// </summary>
 public static IEnumerable <HtmlAgilityPack.HtmlNode> SelectChildren(this HtmlAgilityPack.HtmlNode source, string elementName)
 {
     return(source.ChildrenSelector(elementName));
 }