Ejemplo n.º 1
0
        private static IEnumerable <KeyValuePair <XPath, ContentLengthMetric> > EvaluateDocumentMetric(DataInfo info)
        {
            var root = HtmlHelpers.GetBody(info.Data);

            if (root == null)
            {
                return(Enumerable.Empty <KeyValuePair <XPath, ContentLengthMetric> >());
            }

            FilterNodes(root);

            return(root.GetAllTags()
                   .ToDictionary(x => x, x => x.GetClearTextLength())
                   .Where(x => x.Value > 0)
                   .Select(x => new KeyValuePair <XPath, ContentLengthMetric>(
                               new XPath(x.Key),
                               new ContentLengthMetric(x, info.Url))));

            //.ToDictionary(x => new XPath(x.Key), x => new ContentLengthMetric(x, info.Url));
        }