Esempio n. 1
0
 public static HtmlNode GetElement(this HtmlNode node, string nodeType)
 {
     return node.ChildNodesRecursive().FirstOrDefault(htmlNode => htmlNode.Name == nodeType);
 }
Esempio n. 2
0
        public static string GetAllText(this HtmlNode node)
        {
            var text = node.ChildNodesRecursive().Select(htmlNode => htmlNode.InnerText).ToList();

            return string.Join(" ", text.Where(s => !string.IsNullOrWhiteSpace(s)));
        }
Esempio n. 3
0
 public static IEnumerable<HtmlNode> GetElementsOfType(this HtmlNode node, string nodeType)
 {
     return node.ChildNodesRecursive().Where(htmlNode => htmlNode.Name == nodeType);
 }
Esempio n. 4
0
        public static string GetElementText(this HtmlNode node, string nodeType)
        {
            var thisNode = node.ChildNodesRecursive().FirstOrDefault(htmlNode => htmlNode.Name == nodeType);

            return thisNode != null ? thisNode.InnerText : null;
        }