Пример #1
0
 private string SafeGetAttributeValue(HtmlNodeCollection collection, string name)
 {
     string result = string.Empty;
     var attr =
         collection
         .Select(n => n.Attributes.FirstOrDefault(a => a.Name == name))
         .FirstOrDefault();
     if (attr != null)
     {
         result = attr.Value;
     }
     return result;
 }
Пример #2
0
        public List<string> GetAllImageSrcs(string str)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.Load(str.ToStream());

            HtmlNodeCollection imgs = new HtmlNodeCollection(doc.DocumentNode.ParentNode);
            imgs = doc.DocumentNode.SelectNodes("//img");
            if (imgs == null || !imgs.Any())
            {
                return null;
            }
            var result = imgs.Select(i => @"https://rally1.rallydev.com"+i.Attributes[@"src"].Value).ToList();
            return result;
        }
Пример #3
0
 public FsdContentItemCells(HtmlNodeCollection nodes)
 {
     _innerHtml = string.Join(string.Empty, nodes.Select(node => node.OuterHtml));
     _cells = nodes.Select((c, i) => new { key = (FsdContentItemProperty)i, value = c.InnerText.Trim() }).ToDictionary(k => k.key, k => k.value);
 }