Example #1
0
        private string Snippet(string url, string attribute)
        {
            XDocument xDoc  = XDocument.Parse(Helper.debugSource(url));
            var       value = from doc in xDoc.Descendants("contentSource").Descendants(XName.Get("div", namespace1))
                              where doc.Attribute("id") != null && doc.Attribute("id").Value.Equals("GroupMulti")
                              select doc.Elements(XName.Get("CodeSnippet", namespace2)).ElementAt(1).Attribute(attribute).Value;

            return(value.ElementAt(0));
        }
Example #2
0
        private bool isExist(string url, string attribute)
        {
            XDocument xDoc = XDocument.Parse(Helper.debugSource(url));
            //var value = xDoc.Descendants("contentSource").Descendants(XName.Get("div", namespace1))
            //            .First(node => node.Attribute("id") != null && node.Attribute("id").Value.Equals("GroupMulti"))
            //            .Elements(XName.Get("CodeSnippet", namespace2)).ElementAt(0)
            //            .Attributes().Any(n => n.Name.LocalName.Equals(attribute));

            var value = (from doc in xDoc.Descendants("contentSource").Descendants(XName.Get("div", namespace1))
                         where doc.Attribute("id") != null && doc.Attribute("id").Value.Equals("GroupMulti")
                         where doc.Elements(XName.Get("CodeSnippet", namespace2)).ElementAt(0).Attributes().Any(n => n.Name.LocalName.Equals(attribute))
                         select doc).Any();

            return(value);
        }