예제 #1
0
        private List <XPathTest> XPathDataTest(String xPathWorker)
        {
            try
            {
                var testList  = new List <XPathTest>();
                var htmlNodes = _htmlDoc.DocumentNode.SelectNodes(xPathWorker);

                if (htmlNodes != null)
                {
                    foreach (var x in htmlNodes)
                    {
                        var newVacancy = new XPathTest
                        {
                            InnerText = x.InnerText.Replace("&nbsp;", " ").Trim()
                        };
                        testList.Add(newVacancy);
                    }
                }
                return(testList);
            }
            catch (NullReferenceException)
            {
                LogRtbAppendText("Exception!" + "\r\n");
                return(new List <XPathTest>());
            }
        }
예제 #2
0
        private List <XPathTest> XPathAttributeTest(String xPathWorker, String attribute)
        {
            try
            {
                var testList  = new List <XPathTest>();
                var htmlNodes = _htmlDoc.DocumentNode.SelectNodes(xPathWorker);

                if (htmlNodes != null)
                {
                    foreach (var x in htmlNodes)
                    {
                        var newVacancy = new XPathTest
                        {
                            Attribute = x.Attributes[attribute].Value
                        };
                        testList.Add(newVacancy);
                    }
                }
                return(testList);
            }
            catch (NullReferenceException)
            {
                LogRtbAppendText("Exception!" + "\r\n");
                return(new List <XPathTest>());
            }
        }