Exemplo n.º 1
0
        private void TestPaing(XmlDocument ixml)
        {
            string           str5;
            string           absoluteAddress = (ixml.DocumentElement.SelectSingleNode("//url") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//url").InnerText.Trim();
            string           wordsBegin      = (ixml.DocumentElement.SelectSingleNode("//paingBegin") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//paingBegin").InnerText;
            string           wordsEnd        = (ixml.DocumentElement.SelectSingleNode("//paingEnd") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//paingEnd").InnerText;
            string           code            = (ixml.DocumentElement.SelectSingleNode("//testContent") == null) ? "" : ixml.DocumentElement.SelectSingleNode("//testContent").InnerText;
            CollectionCommon common          = new CollectionCommon();

            if (!string.IsNullOrEmpty(common.GetPaing(code, wordsBegin, wordsEnd)))
            {
                str5 = common.ConvertToAbsluteUrl(common.GetPaing(code, wordsBegin, wordsEnd), absoluteAddress);
            }
            else
            {
                str5 = "没有截取到下一页URL,请加载源代码重新设置下。";
            }
            XmlTextWriter writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            writer.Formatting  = Formatting.Indented;
            writer.Indentation = 4;
            writer.WriteStartDocument();
            writer.WriteStartElement("root", "");
            writer.WriteElementString("testContent", str5);
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }
        protected void BtnPaingType1_Click(object sender, EventArgs e)
        {
            CollectionCommon common = new CollectionCommon();
            Uri    url      = new Uri(this.TxtListAddress.Text);
            string coding   = this.CodingType(this.RadlCodeType.SelectedValue);
            string httpPage = common.GetHttpPage(url, coding);

            this.TxtShowCode.Text = common.ConvertToAbsluteUrl(common.GetPaing(httpPage, this.TxtPaingBegin.Text, this.TxtPaingEnd.Text), url.ToString());
        }