Esempio n. 1
0
        public void SetUp()
        {
            _xPath = new XpathModel()
            {
                AllSeriesXpath  = "//ul/li/a",
                AllChapterXpath = "//ul/li/a",
                ImageXpath      = "//a[1]",
                NextLinkXpath   = "//body/a[last()]"
            };
            _objParse = new ParseHtml(_xPath);

            _html = new StringBuilder();
            _html.Append("<HTML>");
            _html.Append("<HEAD>");
            _html.Append("<TITLE>Your Title Here</TITLE>");
            _html.Append("</HEAD>");
            _html.Append("<BODY BGCOLOR=\"FFFFFF\">");
            _html.Append("<a href=\"http://testsite.com\">Link Name</a>");
            _html.Append("<H1>This is a Header</H1>");
            _html.Append("<H2>This is a Medium Header</H2>");
            _html.Append("<ul>");
            _html.Append("<li><a href=\"item1.com\">This is List item 1</a></li>");
            _html.Append("<li><a href=\"item2.com\">This is List item 2</a></li>");
            _html.Append("<li><a href=\"item3.com\">This is List item 3</a></li>");
            _html.Append("<li><a href=\"item4.com\">This is List item 4</a></li>");
            _html.Append("</ul>");
            _html.Append("Send me mail at <a href=\"mailto:[email protected]\">[email protected]</a>.");
            _html.Append("<P> This is a new paragraph!");
            _html.Append("<P> <B>This is a new paragraph!</B>)");
            _html.Append("<BR> <B><I>This is a new sentence without a paragraph break, in bold italics.</I></B>");
            _html.Append("<HR>");
            _html.Append("</BODY>");
            _html.Append("</HTML>");
        }
Esempio n. 2
0
        public static XpathModel MapToXpathModel(ConfigurationModel config)
        {
            XpathModel xpath = null;

            if (config != null)
            {
                xpath = new XpathModel();
                xpath.AllChapterXpath = config.AllChapterXpath;
                xpath.AllSeriesXpath  = config.AllSeriesXpath;
                xpath.ImageXpath      = config.ImageXpath;
                xpath.NextLinkXpath   = config.NextLinkXpath;
            }
            return(xpath);
        }
Esempio n. 3
0
        public ParseHtml(XpathModel xpath)
        {
            _htmlDoc = new HtmlDocument();

            if (xpath == null)
            {
                if (DomainSettings.Configurations == null)
                {
                    throw new MangaScrapperException("Configuration Missing");
                }

                var SelectedConfiguration = DomainSettings.Configurations.GetSelected();
                _xpath = Mapper.MapToXpathModel(SelectedConfiguration);
            }
            else
            {
                _xpath = xpath;
            }
        }
Esempio n. 4
0
        // GET: Xpath
        public ActionResult Index()
        {
            XpathModel model = new XpathModel();

            return(View(model));
        }