Hello Team
i am a newbie in c#, i have was asked to come up with a program that extracts information from websites and stores in txt, or any other readable format. now i managed to do the program.

my problem now is i am extracting information from a site that sells books its a chinese website. i want to extract data from a query i ran and have to extract the data of the results in uniform thus
find the string <div class="listitem pic" from page, and

//extract maintitle
//extract publicer info
//using name="Publishing" to extract publishing company
//using class="describ" to extract desciption
//using class="panel price" to extract price extract price_d and price_m
// extract discount

and so on, how do i use the vectors in c# to get such information. my code so far stands at..

using System;
using System.Collections.Generic;
using System.Text;

using System.Net;
using System.IO;
//using system.linq;
namespace project_sougu
{
    class Program
    {
        static void Main(string[] args)
        {
            // used to build entire input



            // prepare the web page we will be asking for
            // print out page source
            String path = "dangdang";
            string temp = readPage("http://search.dangdang.com/search.php?key=%C7%C7%B2%BC%CB%B9&SearchFromTop=1&catalog=", "gb2312");
            StreamWriter sw = File.CreateText(path);
            sw.Write(temp);
 //           new pause();
           
        }


        static string readPage(string url, string type)
        {
            HttpWebRequest request = (HttpWebRequest)
                WebRequest.Create(url);

            // execute the request
            HttpWebResponse response = (HttpWebResponse)
                request.GetResponse();

            // we will read data via the response stream
            Stream resStream = response.GetResponseStream();
            string tempString;
            using (StreamReader sr = new StreamReader(resStream, Encoding.GetEncoding(type)))
            {
                tempString = sr.ReadToEnd();
            }
            return tempString;
        }

        static List<List<string> > extractAttribute(string page)  //
        {
            List<List<string>> allresult = new List<List<string>>();
         
            //each result is a vector ,the length of this vector  is seven, maintitle author publishing description price_d price_m discount
            List<string> result = new List<string>(7);
            result[0] = "jobs";
            result[1] = "jobs,stevie";
            result[2] = "title";
            result[3] = "publishing house";
            result[4] = "24.20";
            result[5] = "39.80";
            result[6] = "year of publish";

            allresult.Add(result);

            return allresult;
        }
    }
}

Recommended Answers

All 8 Replies

Does your application get a response back from the Web site? Please post the response (same as what you're writing to the "dangdang" file) so we can help you figure out how to extract the data you want.

yeah the program gets a response it sends to a text file dangdang.txt. it copies the source code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>steve jobs-当当图书</title>
<meta name="Keywords" content="steve jobs,当当steve jobs" />
<meta name="description" content="当当在线提供steve jobs等热门畅销图书产品;700多城市货到付款,全场购物满29元免运费" />
<link  href="/css/dangdang.css?0728.css" rel="stylesheet" type="text/css" />
<link  href="/css/search.css?0728.css" rel="stylesheet" type="text/css" />
</head>

<body>

            <link href="http://static.dangdang.com/css/header2010/unite_header_20110818.css?42" rel="stylesheet" type="text/css">
        <script src="http://static.dangdang.com/js/header2010/pagetop_new.js?42" type="text/javascript"></script>
     <div class="ddnewhead_wrap ">
                  <div class="ddnewhead_operate" id="__ddnav_menu">
          <ul class="ddnewhead_operate_nav">
            <li><a href="http://www.dangdang.com">返回首页</a></li><li class="ddnewhead_separate"></li>            <li class="ddnewhead_cart"><a href="javascript:AddToShoppingCart(0);">购物车<span id="cart_items_count" class="cart_num"></span></a></li>
            <li class="ddnewhead_separate"></li>
            <li><a href="http://order.dangdang.com/myallorders.aspx" target="_blank">我的订单</a></li>
            <li class="ddnewhead_separate"></li>
            <li class="ddnewhead_mydd"><a href="http://my.dangdang.com/myhome/homepage.aspx" target="_blank" class="menu_btn" id="a_myddchannel" onmouseover="showgaoji('a_myddchannel','__ddnav_mydd')" onmouseout="hideotherchannel('a_myddchannel','__ddnav_mydd');">我的当当</a>
                <div  class="ddnewhead_mydd_panel" onmouseover="showgaoji('a_myddchannel','__ddnav_mydd')" onmouseout="hideotherchannel('a_myddchannel','__ddnav_mydd');" id="__ddnav_mydd" >
                    <ul class="ddnewhead_mydd_list" >
                        <li><a href="http://order.dangdang.com/myallorders.aspx" target="_blank">我的订单</a></li>
                        <li><a href="http://account.dangdang.com/payhistory/mycoupons.aspx" target="_blank">购物礼券</a></li>
                        <li><a href="http://my.dangdang.com/memberpoints/index.aspx" target="_blank">我的积分</a></li>
                        <li><a href="http://customer.dangdang.com/wishlist/cust_wish_list.aspx" target="_blank">我的收藏</a></li>
                    </ul>
                </div>
            </li>
            <li class="ddnewhead_separate"></li>
            <li class="ddnewhead_gcard"><a href="http://misc.dangdang.com/giftcard/GiftCardIndex.aspx" class="menu_btn"  id="a_lipchannel" onmouseover="showgaoji('a_lipchannel','__ddnav_card');" onmouseout="hideotherchannel('a_lipchannel','__ddnav_card');" target="_blank">礼品卡</a>
                <div  class="ddnewhead_gcard_panel" onmouseover="showgaoji('a_lipchannel','__ddnav_card')" onmouseout="hideotherchannel('a_lipchannel','__ddnav_card');" id="__ddnav_card">
                <ul class="ddnewhead_gcard_list">
                    <li><a href="http://misc.dangdang.com/giftcard/GiftCardIndex.aspx" target="_blank">购买</a></li>
                    <li><a href="http://account.dangdang.com/payhistory/mymoney.aspx" target="_blank">激活</a></li>
                    <li><a href="http://misc.dangdang.com/giftcard/GiftCard_tuangou.aspx" target="_blank">团购</a></li>
                </ul>
                </div>
            </li>
            <li class="ddnewhead_separate"></li>
                        <li class="ddnewhead_help"><a href="http://support.dangdang.com/helpcenter/" class="menu_btn" id="a_help_panel" onmouseover="showgaoji('a_help_panel','__ddnav_help');" onmouseout="hideotherchannel('a_help_panel','__ddnav_help');" target="_blank">帮&nbsp;助</a>
                <div class="ddnewhead_help_panel" style="display:none" id="__ddnav_help" onmouseover="showgaoji('a_help_panel','__ddnav_help');" onmouseout="hideotherchannel('a_help_panel','__ddnav_help');">
                  <ul class="ddnewhead_help_list">
                      <li><a href="http://support.dangdang.com/helpcenter/api_cms/helpcenter/index/index.shtml" target="_blank">自助服务</a></li>
                      <li><a href="http://support.dangdang.com/helpcenter/email_contact.php" target="_blank">投诉反馈</a></li>
                      <li><a href="http://robot.dangdang.com/WebIm/forward?id=51236699" target="_blank">在线小当当</a></li>
                  </ul>
                </div>
            </li>
                      </ul>
          <p id="nickname"><span>欢迎光临当当网,请</span><a href="https://login.dangdang.com/Signin.aspx" name="ddnav_login" target="_blank" class="login_link">登录</a><a href="https://login.dangdang.com/Register.aspx" name="ddnav_register" target="_self" class="login_link">免费注册</a></p>
    </div>
               <div class="ddnewhead_content">
            <div class="ddnewhead_logo"><a href="http://www.dangdang.com" title="返回首页" name="ddnav_logo"><img src="http://img4.ddimg.cn/header/header2010/ddnewhead_logo_110617.gif" alt="当当网"/></a></div>
      <div class="ddnewhead_slogan">网上购物享当当</div>
      <div class="ddnewhead_topnav" id="__ddnav_class1">
        <ul class="ddnewhead_mainnav" >
          <li><a href="http://www.dangdang.com" class="home"><span>首页</span></a></li>
                    <li><a href="http://book.dangdang.com" class="book now"><span>图书</span></a></li>
          <li><a href="http://cosmetic.dangdang.com" class=""><span>美 妆</span></a></li>
          <li><a href="http://living.dangdang.com" class=""><span>家 居</span></a></li>
          <li><a href="http://static.dangdang.com/topic_custom/store/2273_198340.shtml" class=""><span>孕婴童</span></a></li>
          <li><a href="http://fashion.dangdang.com" class=""><span>服 装</span></a></li>
          <li><a href="http://category.dangdang.com/3c" class=""><span>数 码</span></a></li>
          <li><a href="http://mall.dangdang.com"><span>商店街</span></a></li>
        </ul>
  </div>
    </div>
     <div class="ddnewhead_hotsort">
       <div class="ddnewhead_hotsort_list"  id="__ddnav_class2">
                      <a target=_blank class='nobg' href=http://bang.dangdang.com/book/bestSeller/>图书畅销榜</a><a target=_blank  href=http://bang.dangdang.com/mall/bestSeller/index.php>百货畅销榜</a><a target=_blank  href=http://bang.dangdang.com/searchkey/>搜索风云榜</a><a target=_blank  href=http://read.dangdang.com/>在线读书</a><a target=_blank  href=http://used.dangdang.com/>二手书</a><a target=_blank  href=http://comm.dangdang.com/review/wonderfulreview.php>书评社区</a><a target=_blank  href=http://bbs.dangdang.com/>论坛</a><a target=_blank  href=http://misc2.dangdang.com/mobile_spread/>手机当当网</a><a target=_blank  href=http://reco.dangdang.com/>猜你喜欢</a><a target=_blank  href=http://misc2.dangdang.com/toolbar/>当当工具栏</a><a target=_blank  href=http://misc.dangdang.com/gifts/index.aspx>积分商城</a>       </div>
    </div>
    <div class="ddnewhead_bottom">
         <div class="ddnewhead_search_panel">
          <h2  id="a_category" class="ddnewhead_category "><a href="http://category.dangdang.com/?ref=www-0-C#ref=www-0-C" target="_blank" name="ddnav_sort_btn" class="menu_btn"  onmouseover=showCategory('a_category','__ddnav_sort','http://static.dangdang.com/js/header2010/categorydata_new.js?20111019'); onmouseout=hiddenCategory(event,'__ddnav_sort')><span>全部商品分类</span></a>
            <div class="newhomepage_sort" style="display:none;"  onmouseover="showCategory('a_category','__ddnav_sort','http://static.dangdang.com/js/header2010/categorydata_new.js?20111019');" onmouseout="hiddenCategory(event,'__ddnav_sort');" id="__ddnav_sort">
                    <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort1"  onmouseover="popmouseOver(1);" onmouseout="amouseOut(1,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort2"  onmouseover="popmouseOver(2);" onmouseout="amouseOut(2,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort3"  onmouseover="popmouseOver(3);" onmouseout="amouseOut(3,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                              <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort4"  onmouseover="popmouseOver(4);" onmouseout="amouseOut(4,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort5"  onmouseover="popmouseOver(5);" onmouseout="amouseOut(5,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort6"  onmouseover="popmouseOver(6);" onmouseout="amouseOut(6,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                             <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort7"  onmouseover="popmouseOver(7);" onmouseout="amouseOut(7,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort8"  onmouseover="popmouseOver(8);" onmouseout="amouseOut(8,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort9"  onmouseover="popmouseOver(9);" onmouseout="amouseOut(9,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort10"  onmouseover="popmouseOver(10);" onmouseout="amouseOut(10,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort11"  onmouseover="popmouseOver(11);" onmouseout="amouseOut(11,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort12"  onmouseover="popmouseOver(12);" onmouseout="amouseOut(12,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort13"  onmouseover="popmouseOver(13);" onmouseout="amouseOut(13,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <div class="docnewhomepage_popup"><div class="newhomepage_popup"  style="display:none;" id="__ddnav_sort14"  onmouseover="popmouseOver(14);" onmouseout="amouseOut(14,0,event,this);"></div></div>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <ul class="newhomepage_sort_nav">
                                        <li id="li_label_1" class="frist" >
                    <a  id="categoryh_1" onmouseover="amouseOver(1,0,event,this,126,'book'); "  onmouseout="amouseOut(1,0,event,this);" href="http://book.dangdang.com/" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_book.gif" /></span>图书音像</a>
                </li>
                                            <div id="popup_promotion_126" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/publication/2272_200968.shtml" target="_blank">图书跳蚤市场19折起.49折封顶</a><a href="http://static.dangdang.com/topic_custom/publication/2272_197063.shtml" target="_blank">2012公务员考试报名开始</a><a href="http://static.dangdang.com/topic_custom/publication/2272_198327.shtml" target="_blank">乔布斯唯一授权的官方传记</a></div></div>
                                                        <li id="li_label_2"  >
                    <a id="categoryh_2" onmouseover="amouseOver(2,0,event,this,1012,'goods');"  onmouseout="amouseOut(2,0,event,this);" href="http://cosmetic.dangdang.com/" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_beauty.gif" /></span>美妆个护</a>
                </li>
                                            <div id="popup_promotion_1012" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/gm/topic/1030_200896.shtml" target="_blank">御泥坊送价值1485元大礼</a><a href="http://static.dangdang.com/topic_custom/store/2273_191583.shtml" target="_blank">洁面大降价 仅此一次</a><a href="http://search.dangdang.com/search_mall.php?q=%D7%CA%C9%FA%CC%C3&cat=&lowp=&highp=&loc=&chk_store=on" target="_blank">资生堂7.3折起</a></div></div>
                                                        <li id="li_label_3"  >
                    <a id="categoryh_3" onmouseover="amouseOver(3,0,event,this,130,'goods');"  onmouseout="amouseOut(3,0,event,this);" href="http://category.dangdang.com/baby" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_baby.gif" /></span>孕婴用品/玩具</a>
                </li>
                                            <div id="popup_promotion_130" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_193990.shtml" target="_blank">宝宝成长清单</a><a href="http://static.dangdang.com/topic_custom/store/2273_194345.shtml" target="_blank">母婴新品速递 折上8折</a><a href="http://static.dangdang.com/topic_custom/store/2273_187331.shtml" target="_blank">孕婴营养品特卖会3折起</a></div></div>
                                                        <li id="li_label_4"  >
                    <a id="categoryh_4" onmouseover="amouseOver(4,0,event,this,156,'goods');"  onmouseout="amouseOut(4,0,event,this);" href="http://category.dangdang.com/list?cat=4004866" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_babycloth.gif" /></span>孕婴童服装/鞋</a>
                </li>
                                            <div id="popup_promotion_156" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_193119.shtml" target="_blank">夏凉商品清仓</a><a href="http://static.dangdang.com/topic_custom/store/2273_195360.shtml" target="_blank">芭比与菲比童鞋清仓</a><a href="http://static.dangdang.com/topic_custom/store/2273_197123.shtml" target="_blank">孕妈妈团购价2折起</a></div></div>
                                                        <li id="li_label_5"  >
                    <a id="categoryh_5" onmouseover="amouseOver(5,0,event,this,131,'goods');"  onmouseout="amouseOut(5,0,event,this);" href="http://category.dangdang.com/home" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_live.gif" /></span>家居/厨具/家纺</a>
                </li>
                                            <div id="popup_promotion_131" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_194259.shtml" target="_blank">LOVO罗孚 清仓专场</a><a href="http://static.dangdang.com/topic_custom/store/2273_182659.shtml" target="_blank">水具惊爆疯抢季</a><a href="http://shop.dangdang.com/6400" target="_blank">博洋开业满月回馈 5折起</a></div></div>
                                                        <li id="li_label_6"  >
                    <a id="categoryh_6" onmouseover="amouseOver(6,0,event,this,982,'goods');"  onmouseout="amouseOut(6,0,event,this);" href="http://category.dangdang.com/furniture" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_furniture.gif" /></span>家具家装</a>
                </li>
                                            <div id="popup_promotion_982" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_190871.shtml" target="_blank">婚庆用品 5折起</a><a href="http://static.dangdang.com/topic_custom/store/2273_191202.shtml" target="_blank">防辐防晒 3折品牌伞</a><a href="http://search.dangdang.com/search_mall.php?q=%CA%B7%B5%A4%C0%FB&tab_type=other" target="_blank">史丹利工具 全场包邮</a></div></div>
                                                        <li id="li_label_7"  >
                    <a id="categoryh_7" onmouseover="amouseOver(7,0,event,this,133,'goods');"  onmouseout="amouseOut(7,0,event,this);" href="http://category.dangdang.com/clothing" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_cloth.gif" /></span>服装/鞋靴</a>
                </li>
                                            <div id="popup_promotion_133" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_200246.shtml" target="_blank">鞋靴大牌 低至2折</a><a href="http://static.dangdang.com/topic_custom/store/2273_200281.shtml" target="_blank">运动鞋品直降150</a><a href="http://static.dangdang.com/topic_custom/store/2273_200867.shtml" target="_blank">斯波迪卡 闪购特惠</a></div></div>
                                                        <li id="li_label_8"  >
                    <a id="categoryh_8" onmouseover="amouseOver(8,0,event,this,152,'goods');"  onmouseout="amouseOut(8,0,event,this);" href="javascript:void(0);" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_shoes.gif" /></span>箱包/手表/饰品</a>
                </li>
                                            <div id="popup_promotion_152" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_193298.shtml" target="_blank">哈尼森 秒杀进行中</a><a href="http://static.dangdang.com/topic_custom/store/2273_193588.shtml" target="_blank">天然美饰特惠9元起</a><a href="http://shop.dangdang.com/5493?act=subject&pid=4112" target="_blank">百团大战 钻石疯送</a></div></div>
                                                        <li id="li_label_9"  >
                    <a id="categoryh_9" onmouseover="amouseOver(9,0,event,this,128,'goods');"  onmouseout="amouseOut(9,0,event,this);" href="javascript:void(0);" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_sports.gif" /></span>运动/户外/汽车</a>
                </li>
                                            <div id="popup_promotion_128" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_200246.shtml" target="_blank">鞋靴大牌 低至2折</a><a href="http://static.dangdang.com/topic_custom/store/2273_200281.shtml" target="_blank">运动鞋品直降150</a><a href="http://static.dangdang.com/topic_custom/store/2273_200867.shtml" target="_blank">斯波迪卡 闪购特惠</a></div></div>
                                                        <li id="li_label_10"  >
                    <a id="categoryh_10" onmouseover="amouseOver(10,0,event,this,155,'goods');"  onmouseout="amouseOut(10,0,event,this);" href="http://static.dangdang.com/gm/topic/1030_197124.shtml" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_health.gif" /></span>营养/保健/成人</a>
                </li>
                                            <div id="popup_promotion_155" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://product.dangdang.com/product.aspx?product_id=9183355" target="_blank">康祝拔罐器,31.9元秒杀全网!</a><a href="http://static.dangdang.com/topic_custom/store/2273_200572.shtml" target="_blank">健康送好礼,足浴盆全场热卖中!</a><a href="http://static.dangdang.com/topic_custom/store/2273_200163.shtml" target="_blank">今天你戴了吗?</a></div></div>
                                                        <li id="li_label_11"  >
                    <a id="categoryh_11" onmouseover="amouseOver(11,0,event,this,154,'goods');"  onmouseout="amouseOut(11,0,event,this);" href="http://category.dangdang.com/food" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_food.gif" /></span>食品/茶/酒</a>
                </li>
                                            <div id="popup_promotion_154" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_200869.shtml" target="_blank">进口食品精选汇</a><a href="http://static.dangdang.com/topic_custom/store/2273_200546.shtml" target="_blank">快乐分享 大白兔</a><a href="http://static.dangdang.com/topic_custom/store/2273_200757.shtml" target="_blank">品原装进口红酒、沐醇正法国风情</a></div></div>
                                                        <li id="li_label_12"  >
                    <a id="categoryh_12" onmouseover="amouseOver(12,0,event,this,1002,'goods');"  onmouseout="amouseOut(12,0,event,this);" href="http://category.dangdang.com/3c" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_cellphone.gif" /></span>手机数码</a>
                </li>
                                            <div id="popup_promotion_1002" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_187981.shtml" target="_blank">手机、相机返利大促销</a><a href="http://static.dangdang.com/topic_custom/store/2273_188337.shtml" target="_blank">学生专场促销</a><a href="http://static.dangdang.com/topic_custom/store/2273_188331.shtml" target="_blank">飞利浦MP3 全场特价</a></div></div>
                                                        <li id="li_label_13"  >
                    <a id="categoryh_13" onmouseover="amouseOver(13,0,event,this,1022,'goods');"  onmouseout="amouseOut(13,0,event,this);" href="http://category.dangdang.com/pc" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_computer.gif" /></span>电脑办公</a>
                </li>
                                            <div id="popup_promotion_1022" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_185614.shtml" target="_blank">不足3000也能买好本</a><a href="http://category.dangdang.com/list?ps=39&cat=4001077&highp=&lowp=&sort=1&store=mt1" target="_blank">电脑DIY 最低1.8元</a><a href="http://static.dangdang.com/topic_custom/store/2273_191831.shtml" target="_blank">西数 2T 699元起</a></div></div>
                                                        <li id="li_label_14"  class="end"  >
                    <a id="categoryh_14" onmouseover="amouseOver(14,0,event,this,132,'goods');"  onmouseout="amouseOut(14,0,event,this);" href="http://category.dangdang.com/electronic" class="nav"><span><img src="http://img4.ddimg.cn/header/header2010/sort/sort_icon_tv.gif" /></span>家用电器</a>
                </li>
                                            <div id="popup_promotion_132" style="display:none;"><div class="popup_title">促销专题</div><div class="alone"><a href="http://static.dangdang.com/topic_custom/store/2273_190865.shtml?ref=category-4000012-RD-1" target="_blank">松下体验馆 5.5折起</a><a href="http://shop.dangdang.com/brand/joyoung" target="_blank">九阳官方旗舰店</a><a href="http://static.dangdang.com/topic_custom/store/2273_200854.shtml" target="_blank">加湿器 取暖器让利促销</a></div></div>
                                </ul>
    <div class="ddnewhead_sort_bottom"></div>
</div>


          </h2>
            <div class="ddnewhead_search ddnewhead_search_none ">
    <form action="http://search.dangdang.com/search.php" name="searchform"  id="form_search_new" onsubmit="return searchsubmit();"  method="GET">
    <input class="ddnewhead_search_input" type="text" value="张正隆四野名将录" name="key" ID="key_S" autocomplete="off" onfocus="this.className='ddnewhead_search_input ddnewhead_search_input_now'; if(this.value!='张正隆四野名将录'){this.style.color='#404040';}else{this.value='';this.style.color='#404040'}" onblur="if(this.value==''){this.value='张正隆四野名将录';this.style.color='#b6b7b9';this.className='ddnewhead_search_input';}" onkeydown="this.style.color='#404040'" />
        <a href="javascript:document.getElementById('search_btn').click()" class="ddnewhead_search_btn" name="ddnav_btn_s"> </a>
    <input type="submit" id="search_btn" style="display:none"/>
    <input id="SearchFromTop" style="display:none" type="hidden" name="SearchFromTop" value="1"/>
    <input type="button" id="suggest_product_btn" name="suggestproduct_btn"  style="display:none" onclick="void(0)"/>
    <input type="button" id="suggest_class_btn" name="suggestclass_btn"  style="display:none" onclick="void(0)"/>
    <input type="submit" id="suggest_searchkey_btn" name="suggestsearchkey_btn"  style="display:none"/>
    <input type="hidden" id="catalog_S" name="catalog" value="" >
    </form>
   <div class="ddnewhead_adsearch">
    <a href="http://search.dangdang.com/AdvanceSearch/AdvanceSearch.aspx?c=0" target="_blank" name="ddnav_adv_s">高级搜索</a>
    <a class="ddnewhead_adsearch_separate" href="http://bang.dangdang.com/searchkey/" target="_blank" name="hot_search">热搜</a><span>:</span><div class="ddnewhead_search_hot"><a href="http://search.dangdang.com/book/search_pub.php?key=%C9%ED%D0%C4%C1%E9&type=hot&catalog=01" name="hotword" target="_blank">身心灵</a><a href="http://search.dangdang.com/book/search_pub.php?key=%BF%BC%D1%D0&type=hot&catalog=01" name="hotword" target="_blank">考研</a><a href="http://search.dangdang.com/book/search_pub.php?key=%BF%A8%C3%B7%C0%AD&type=hot&catalog=01" name="hotword" target="_blank">卡梅拉</a></div>
   </div>
  </div>
          <div class="clear"></div>
         </div>
    </div>
</div>
<script type="text/javascript">initHeaderOperate();Suggest_Initialize("key_S",255,0,30);</script>
<script type="text/javascript" src="http://login.dangdang.com/script/LoginWindow.js"></script>
<div id="ad_cpm_4" class="search_topbanner"></div>
<div class="search_wrap">
<div class="search_toppanel">
	<div class="search_keylist">
		<p>在<a href="http://search.dangdang.com/search.php?key=steve jobs&stop=1" class="root_category">全部商品</a>&gt;<span class="sub_category">图书音像</span>中搜索<span id="keyword" class="keywords">steve jobs</span>
		</p>
	</div>
</div>
<div class="search_leftpanel">
          <div class="search_category search_category_level1" id="div_category">
        	<h2>图书音像</h2>
            	<div class="search_category_panel">
		<ul>
		<li><a href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&category=01.38" name="p_cls" onclick="s('clickcat','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');">传记<span class="num">(2)</span></a></li>
		<li><a href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&category=01.03" name="p_cls" onclick="s('clickcat','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');">小说<span class="num">(1)</span></a></li>
		<li><a href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&category=01.58" name="p_cls" onclick="s('clickcat','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');">进口图书、港台图<span class="num">(3)</span></a></li>
		<li><a href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&category=01.21" name="p_cls" onclick="s('clickcat','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');">成功/励志<span class="num">(2)</span></a></li>
		<li><a href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&category=01.22" name="p_cls" onclick="s('clickcat','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');">管理<span class="num">(3)</span></a></li>
		<li><a href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&category=01.45" name="p_cls" onclick="s('clickcat','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');">外语<span class="num">(2)</span></a></li>
		</ul>
            	</div>
            <div class="search_category_bottom"></div>
          </div>

<div class="left_pic_ad" id="ad_cpt_11241_11242_11243_11244"><span class="loading">请稍候...</span></div>
<div class="left_pic_ad left_pic_ad_inner" id="ad_cpt_10073"></div>
<div id="ad_cpc"></div>
</div>

<div class="search_rightpanel">
<div id="div_rectify" name="__rela_top_p"></div>
<div class="search_list public_list">
	<div class="tab_panel ">
		<a name="tab_all" href="javascript:void(0)" class="active"><span>图书音像</span></a>
		<a name="tab_book" href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&tab_type=pub" ><span>图书(13)</span></a>
		<a name="tab_media" href="javascript:viod(0)"  class="none"><span>音乐影视(0)</span></a>
		<div class="result_count">共搜到<strong>13</strong>个商品</div>
		<div class="clear"></div>
	</div>
	<div class="public_search">
		<div class="control_panel">
		<div class="simple_panel">
<div class="page_Simplified"><span class="nextpage eof">下一页</span><span>1</span><span class="prevpage bof">上一页</span><div class="clear"></div></div>	<div class="check_filter">
	<span class="checkitem">筛选:</span>
<div class="checkitem" id="__hot_only">
	<input id="chx" type="checkbox" onclick="redirect('http://search.dangdang.com/search_pub.php?key=steve%20jobs&filter=bestseller')"/><label for="chx" title="畅销">畅销</label>
</div>
<div class="checkitem" id="__sale_only">
	<input id="cx" type="checkbox" onclick="redirect('http://search.dangdang.com/search_pub.php?key=steve%20jobs&filter=promotion')"/><label for="cx" title="促销">促销</label>
</div>
<div class="checkitem" id="__stock_only">
	<input id="yh" type="checkbox" onclick="redirect('http://search.dangdang.com/search_pub.php?key=steve%20jobs&page=0&instock=1')"/><label for="yh" title="只显示有货">只显示有货</label>
</div>
	</div>
	<div class="btn_filter">
		<span class="search_tip">排序:</span>
	<a class="default active" title="默认排序" name="ord_def"><span class="text">默认排序</span></a>
	<a onclick="s('sort_xsalen_desc','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');" href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&order=sort_xsalen_desc" title="按销量降序" name="ord_sale"><span class="text">销 量</span><span class="arrow down"></span></a>
	<a onclick="s('sort_xevaluate_desc','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');" href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&order=sort_xevaluate_desc" title="按评论数降序" name="ord_com"><span class="text">评论数</span><span class="arrow down"></span></a>
	<a onclick="s('sort_xsaleprice_asc','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');" href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&order=sort_xsaleprice_asc" title="按价格升序" name="ord_price_u"><span class="text">价 格</span><span class="arrow up"></span></a>
	<a onclick="s('sort_xtime_desc','steve%20jobs','','','13_1_25','','','0_0_0_p','','','');" href="http://search.dangdang.com/search_pub.php?key=steve%20jobs&order=sort_xtime_desc" title="按出版时间降序" name="ord_time"><span class="text">出版时间</span><span class="arrow down"></span></a>
	</div>

			<div class="clear"></div>
			</div>
		</div>
		</div>
<ul>
<li>
<div class="listitem pic" onmouseover="block_toggle('#reco_22484707_bg,#reco_22484707','display')" onmouseout="block_toggle('#reco_22484707_bg,#reco_22484707','none')">
<a onclick="s('click','steve%20jobs','01.38.33.00','','13_1_25','','','22484707_1_8847873_p','','','');" href="http://product.dangdang.com/product.aspx?product_id=22484707&ref=search-1-pub" target="_blank" name="p_img"><img class="lazy_img" src="http://img37.ddimg.cn/25/29/22484707-1_l.jpg" alt="史蒂夫·乔布斯传(乔布斯留给世人最后的礼物:唯一授权传记简体中文版 预售商品10月24日全球同步上市。永远的乔布斯!)" /></a>
<div class="overlay" id="reco_22484707_bg"></div>
<div class="overlay1" id="reco_22484707">
<p><span><img src="images/icon_overtip.gif"/></span><a title="喜欢此商品的人还喜欢" href="http://reco.dangdang.com/reco_pub.php?product_id=22484707" target="_blank">喜欢此商品的人还喜欢</a></p>
</div>
</div>
<div class="listitem detail"> 
<ul class="tiplist">
<li class="maintitle">
<a onclick="s('click','steve%20jobs','01.38.33.00','','13_1_25','','','22484707_1_8847873_p','','','');" href="http://product.dangdang.com/product.aspx?product_id=22484707&ref=search-1-pub" target="_blank" name="p_name">史蒂夫·乔布斯传(乔布斯留给世人最后的礼物:唯一授权传记简体中</a>
<div class="clear"></div>
</li>
<li class="subtitle"><p></p></li>
<li class="starlevel">
<a class="comment_star" title="显示所有评论" href="http://union.dangdang.com/transfer_inner.php?ad_id=List_Comm_num&ad_type=0&sys_id=5&backurl=http://comm.dangdang.com/review/reviewlist.php%3Fpid=22484707" target="_blank" name="p_comm"><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /></a>
<span>
 (<a href="http://union.dangdang.com/transfer_inner.php?ad_id=List_Comm_num&ad_type=0&sys_id=5&backurl=http://comm.dangdang.com/review/reviewlist.php%3Fpid=22484707" target="_blank" name="p_comm">69</a>条)
</span>
<div class="clear"></div>
</li>
<li class="publicer_info">
[美] <a href="http://search.dangdang.com/search_pub.php?key=&key2=沃尔特&category=01" title="沃尔特" name="author">沃尔特</a>&#8226;<a href="http://search.dangdang.com/search_pub.php?key=&key2=艾萨克森&category=01" title="艾萨克森" name="author">艾萨克森</a>(<a href="http://search.dangdang.com/search_pub.php?key=&key2=Walter&category=01" title="Walter" name="author">Walter</a> <a href="http://search.dangdang.com/search_pub.php?key=&key2=Isaacson&category=01" title="Isaacson" name="author">Isaacson</a>)  著/2011年11月/<a href=http://search.dangdang.com/search_pub.php?key=&key3=中信出版社&category=01 name="Publishing">中信出版社</a></li>
<li class="describ">
<p>&nbsp;&nbsp;&nbsp;&nbsp;
为了这本传记,艾萨克森与乔布斯进行了40多次面对面交流,直到乔布斯生命最后的日子,除了医生和家人之外,他是乔布斯亲自见的几个人之一。

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...</p></li>
<li>
<div class="panel operate">
<a onclick="s('preorder','steve%20jobs','01.38.33.00','','13_1_25','','','22484707_1_8847873_p','','','');" href="javascript:AddToShoppingCart('22484707')" name="p_pre"><img title="预 售" alt="预 售" src="http://img4.ddimg.cn/common/btn_order.gif"/></a>
<a onclick="s('favor','steve%20jobs','01.38.33.00','','13_1_25','','','22484707_1_8847873_p','','','');" id="lcase22484707" href="javascript:AddToWishList('22484707')" name="p_fav"><img title="收 藏" alt="收 藏" src="http://img4.ddimg.cn/common/btn_keep.gif"/></a>
</div>
<div class="panel price">
<span class="price_d">¥<span class="num">51.00</span></span><span class="price_m">¥<span class="num">68.00</span></span>
<span class="discount">折扣:75折</span>

</div>
</li>
</ul>
</div>

<div class="clear"></div>                   
</li>
<li>
<div class="listitem pic" onmouseover="block_toggle('#reco_22490340_bg,#reco_22490340','display')" onmouseout="block_toggle('#reco_22490340_bg,#reco_22490340','none')">
<a onclick="s('click','steve%20jobs','01.58.04.00','','13_1_25','','','22490340_2_161025_p','','','');" href="http://product.dangdang.com/product.aspx?product_id=22490340&ref=search-1-pub" target="_blank" name="p_img"><img class="lazy_img" src="http://img30.ddimg.cn/15/1/22490340-1_l.jpg" alt="Steve Jobs - The Exclusive Biography 乔布斯传记-美国版精装 (10月24日出版,预计11月初到货)ISBN=9781451648539" /></a>
<div class="overlay" id="reco_22490340_bg"></div>
<div class="overlay1" id="reco_22490340">
<p><span><img src="images/icon_overtip.gif"/></span><a title="喜欢此商品的人还喜欢" href="http://reco.dangdang.com/reco_pub.php?product_id=22490340" target="_blank">喜欢此商品的人还喜欢</a></p>
</div>
</div>
<div class="listitem detail"> 
<ul class="tiplist">
<li class="maintitle">
<a onclick="s('click','steve%20jobs','01.58.04.00','','13_1_25','','','22490340_2_161025_p','','','');" href="http://product.dangdang.com/product.aspx?product_id=22490340&ref=search-1-pub" target="_blank" name="p_name">Steve Jobs - The Exclusive Biography 乔布斯传记-美国版精装 (</a>
<div class="clear"></div>
</li>
<li class="subtitle"><p></p></li>
<li class="starlevel">
<a class="comment_star" title="显示所有评论" href="http://union.dangdang.com/transfer_inner.php?ad_id=List_Comm_num&ad_type=0&sys_id=5&backurl=http://comm.dangdang.com/review/reviewlist.php%3Fpid=22490340" target="_blank" name="p_comm"><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /></a>
<span>
 (<a href="http://union.dangdang.com/transfer_inner.php?ad_id=List_Comm_num&ad_type=0&sys_id=5&backurl=http://comm.dangdang.com/review/reviewlist.php%3Fpid=22490340" target="_blank" name="p_comm">15</a>条)
</span>
<div class="clear"></div>
</li>
<li class="publicer_info">
<a href="http://search.dangdang.com/search_pub.php?key=&key2=Walter&category=01" title="Walter" nam

i have observed that each result/book has atleast 8 strings represented as i said be fore meaning i want to add code that will only retrieve each results infor

<div class="listitem pic" onmouseover="block_toggle('#reco_22484707_bg,#reco_22484707','display')" onmouseout="block_toggle('#reco_22484707_bg,#reco_22484707','none')">
<a onclick="s('click','steve%20jobs','01.38.33.00','','13_1_25','','','22484707_1_8547329_p','','','');" href="http://product.dangdang.com/product.aspx?product_id=22484707&ref=search-1-pub" target="_blank" name="p_img"><img class="lazy_img" src="http://img37.ddimg.cn/25/29/22484707-1_l.jpg" alt="史蒂夫·乔布斯传(乔布斯留给世人最后的礼物:唯一授权传记简体中文版 预售商品10月24日全球同步上市。永远的乔布斯!)" /></a>
<div class="overlay" id="reco_22484707_bg"></div>
<div class="overlay1" id="reco_22484707">
<p><span><img src="images/icon_overtip.gif"/></span>







[B]<a title="[/B]喜欢此商品的人还喜欢" href="http://reco.dangdang.com/reco_pub.php?product_id=22484707" target="_blank">喜欢此商品的人还喜欢</a></p>
</div>
</div>







[B]<div class="listitem detail"> [/B]<ul class="tiplist">
<li class="maintitle">
<a onclick="s('click','steve%20jobs','01.38.33.00','','13_1_25','','','22484707_1_8547329_p','','','');" href="http://product.dangdang.com/product.aspx?product_id=22484707&ref=search-1-pub" target="_blank" name="p_name">史蒂夫·乔布斯传(乔布斯留给世人最后的礼物:唯一授权传记简体中</a>
<div class="clear"></div>
</li>








[B]<li class="subtitle"><p></p></li[/B]>
<li class="starlevel">








<[B]a class="comment_star" title[/B]="显示所有评论" href="http://union.dangdang.com/transfer_inner.php?ad_id=List_Comm_num&ad_type=0&sys_id=5&backurl=http://comm.dangdang.com/review/reviewlist.php%3Fpid=22484707" target="_blank" name="p_comm"><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /><img src='/images/star_all.gif' /></a>
<span>
 (<a href="http://union.dangdang.com/transfer_inner.php?ad_id=List_Comm_num&ad_type=0&sys_id=5&backurl=http://comm.dangdang.com/review/reviewlist.php%3Fpid=22484707" target="_blank" name="p_comm">88</a>条)
</span>
<div class="clear"></div>
</li>










[B]<li class="publicer_info">[/B][美] <a href="http://search.dangdang.com/search_pub.php?key=&key2=沃尔特&category=01" title="沃尔特" name="author">沃尔特</a>&#8226;<a href="http://search.dangdang.com/search_pub.php?key=&key2=艾萨克森&category=01" title="艾萨克森" name="author">艾萨克森</a>(<a href="http://search.dangdang.com/search_pub.php?key=&key2=Walter&category=01" title="Walter" name="author">Walter</a> <a href="http://search.dangdang.com/search_pub.php?key=&key2=Isaacson&category=01" title="Isaacson" name="author">Isaacson</a>)  著/2011年11月/<a href=http://search.dangdang.com/search_pub.php?key=&key3=中信出版社&category=01 name="Publishing">中信出版社</a></li>










<[B]li class="describ">[/B]<p>&nbsp;&nbsp;&nbsp;&nbsp;
为了这本传记,艾萨克森与乔布斯进行了40多次面对面交流,直到乔布斯生命最后的日子,除了医生和家人之外,他是乔布斯亲自见的几个人之一。

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...</p></li>
<li>










[B]<div class="panel price">[/B]<span class="price_d">¥<span class="num">51.00</span></span><span class="price_m">¥<span class="num">68.00</span></span>
<span class="discount">

The site is returning XHTML; this is a good thing. It seems to me that the simplest approach is to load the response as an XML document, and then use a few XPath queries to get the data you need. Are you familiar with the System.Xml namespaces at all?

unfortunately am not i will have to look into them. thanx!

went through Xml namespace now i have a tiny problem at hand i have done most of the work i have used httpwebreust to request for the data from the page..

i have also written the code that am not sure with for extracting information but am havin a challenge in using the regular expressions to find result r1 thats first result to last result attribut which is the discount please can someone help with that piece of code ?


here is my code for now

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;

namespace my_Project
{
    class Program
    {
        static void Main(string[] args)
        {
            String path = "dangdangFile";
            string temp = readPage("http://search.dangdang.com/search.php?key=%C7%C7%B2%BC%CB%B9&SearchFromTop=1&catalog=", "gb2312");
            StreamWriter sw = File.CreateText(path);
            sw.Write(temp);

        }
        static string readPage(string url, string type)
        {
            HttpWebRequest request = (HttpWebRequest)
                WebRequest.Create(url);


            //Execute the request

            HttpWebResponse response = (HttpWebResponse)
                request.GetResponse();

            //Reading the data via the response stream.

            Stream resStream = response.GetResponseStream();
            string tempString;
            using (StreamReader sr = new StreamReader(resStream,Encoding.GetEncoding((type))))
            {

                tempString = sr.ReadToEnd();
            }

            return tempString;

        }
        static List<List<string>> extractResult(string page)
        {
            List<List<string>> allresult = new List<List<string>>();
//            find first result r1, use parseAttribute(r1);
            // to do
            
      

    
            
            return allresult;
        }
        static List<string> parseAttribute(string r)
        {
            List<string> result=new List<string>();
            int startIndex=0;
            int endIndex = 0;
            int index=0;



            string listimpcString = "lip=\"list item pic\">";
            startIndex = endIndex;
            index = r.IndexOf(listimpcString, startIndex);
            string allpics = ",";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + listimpcString.Length);
                string lsst = r.Substring(index, endIndex - index);
                allpics += lsst;
                allpics += ",";
                startIndex = endIndex;
                index = r.IndexOf(listimpcString, startIndex);
            }
            result.Add(allpics);


            //parse another attrib

            string nameString = "name=\"Author\">";
            startIndex = endIndex;
            index = r.IndexOf(nameString, startIndex);
            string allName = "";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + nameString.Length);
                string name = r.Substring(index, endIndex - index);
                allName += name;
                allName += ",";
                startIndex = endIndex;
                index = r.IndexOf(nameString, startIndex);
            }
            result.Add(allName);
    




            // parse another attributes 

            string publicerString = "publicer=\"Publicer_info\">";
            startIndex = endIndex;
            index = r.IndexOf(publicerString, startIndex);
            string allInfo = "";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + publicerString.Length);
                string publicer = r.Substring(index, endIndex - index);
                allInfo += publicer;
                allInfo += ",";
                startIndex = endIndex;
                index = r.IndexOf(publicerString, startIndex);
            }
            result.Add(allInfo);
             
            //parsing another attribute

            string ttleString = "titl=\"title\">";
            startIndex = endIndex;
            index = r.IndexOf(ttleString, startIndex);
            string alltittle = "";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + ttleString.Length);
                string titl = r.Substring(index, endIndex - index);
                alltittle += titl;
                alltittle += ",";
                startIndex = endIndex;
                index = r.IndexOf(ttleString, startIndex);

            }
            result.Add(alltittle);

            //parsing another attribute 

            string listitemdString = "lstitmdtl=\"listitemdetail\">";
            startIndex = endIndex;
            index = r.IndexOf(listitemdString, startIndex);
            string alllsttmdtl = ",";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + listitemdString.Length);
                string lstitmdtl = r.Substring(index, endIndex - index);
                alllsttmdtl += lstitmdtl;
                alllsttmdtl += ",";
                startIndex = endIndex;
                index = r.IndexOf(listitemdString, startIndex);

            }
            result.Add(alllsttmdtl);

            //parsing another attribute

            string describeString = "descr=\"describ\">";
            startIndex = endIndex;
            index = r.IndexOf(describeString, startIndex);
            string alldescrib = ",";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + describeString.Length);
                string descr = r.Substring(index, endIndex - index);
                alldescrib += descr;
                alldescrib += ",";
                startIndex = endIndex;
                index = r.IndexOf(describeString, startIndex);
            }

            result.Add(alldescrib);

            //add another attrib


            string panlpriceString = "pp=\"panel price\">";
            startIndex = endIndex;
            index = r.IndexOf(panlpriceString, startIndex);
            string allprice = ",";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + describeString.Length);
                string panel = r.Substring(index, endIndex - index);
                allprice += panel;
                allprice += ",";
                startIndex = endIndex;
                index = r.IndexOf(panlpriceString, startIndex);

        }

            result.Add(allprice);

            // parse another attrib

            string sbtitleString = "st=\"subtitle\">";
            startIndex = endIndex;
            index = r.IndexOf(sbtitleString, startIndex);
            string allsubs = ",";
            while (index != -1)
            {
                endIndex = r.IndexOf("<", index + sbtitleString.Length);
                string sbtl = r.Substring(index, endIndex - index);
                allsubs += sbtl;
                allsubs += ",";
                startIndex = endIndex;
                index = r.IndexOf(sbtitleString, startIndex);

            }

            result.Add(allsubs);

            //parse another attrib


            string cmmntstrString = "commntstr=\"comment_star\">";
            startIndex = endIndex;
            index = r.IndexOf(cmmntstrString, startIndex);
            string allcmmnts = ",";
            while (index != -1)
            {

                endIndex = r.IndexOf("<", index + cmmntstrString.Length);
                string cmmnt = r.Substring(index, endIndex - index);
                allcmmnts += cmmnt;
                allcmmnts += ",";
                startIndex = endIndex;
                index = r.IndexOf(cmmntstrString, startIndex);
            }

            result.Add(allcmmnts);

            //parse another attrib




            return result;

        }
    }
}

i mean httpwebrequest...a typo there

I see that you're still processing the string directly; what I meant is load this string into an XmlDocument. Then you can use methods on the document like SelectNodes and SelectSingleNode to do XPath queries on the document, which would make your code much shorter and easier to read and understand.

If you post a complete XHTML result--as a file, please, not in a code block--I can post a few sample XPath queries to get you started.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.