| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 595 人关注过本帖
标题:C# 解析XML
只看楼主 加入收藏
wengold
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-7-1
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
C# 解析XML
<table width="778" border="1" cellspacing="0" cellpadding="0" align="center">

    <tr>

      <td width="168" height="36" bgcolor="#262626" class="styleTopTitle">影院:<span class="styleTopContent">浙江翠苑电影大世界</span></td>

      <td bgcolor="#262626" class="styleTopTitle">影片:</td>

      <td width="90" bgcolor="#262626" class="styleTopTitle">影厅:</td>

      <td width="115" bgcolor="#262626" class="styleTopTitle">日期:</td>

      <td width="115" bgcolor="#262626" class="styleTopTitle">场次:</td>

    </tr>

    <tr>

      <td height="36" class="styleTopTitle">服务方式:</td>

      <td class="styleTopTitle">支付方式:</td>

      <td class="styleTopTitle">票数:</td>

      <td class="styleTopTitle">价格:</td>

      <td class="styleTopTitle">含手续费:</td>

    </tr>

  </table>

<div style="width: 778px; margin: 0 auto; background-color: #191919;">

  <table width="766" border="0" cellspacing="0" cellpadding="3" style="margin: 6px;">

    <tr>

      <td height="48" class="styleFilm">假装情侣 (普通话)</td>

    </tr>

    <tr>

      <td height="92" align="center" valign="top" bgcolor="#2F2F2F">

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-25" href="javascript:ParamSubmit('001','5','5号厅','0011760101','假装情侣','2011-07-06','1000','1','01');"

          title="5号厅剩余座位数:102 结束时间:2011-07-06 11:25:00.0">10:00</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-25" href="javascript:ParamSubmit('001','5','5号厅','0011760101','假装情侣','2011-07-06','1140','2','01');"

          title="5号厅剩余座位数:102 结束时间:2011-07-06 13:05:00.0">11:40</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-25" href="javascript:ParamSubmit('001','5','5号厅','0011760101','假装情侣','2011-07-06','1320','3','01');"

          title="5号厅剩余座位数:102 结束时间:2011-07-06 14:45:00.0">13:20</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-25" href="javascript:ParamSubmit('001','5','5号厅','0011760101','假装情侣','2011-07-06','1500','4','01');"

          title="5号厅剩余座位数:102 结束时间:2011-07-06 16:25:00.0">15:00</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-25" href="javascript:ParamSubmit('001','5','5号厅','0011760101','假装情侣','2011-07-06','1830','6','01');"

          title="5号厅剩余座位数:102 结束时间:2011-07-06 19:55:00.0">18:30</a></div></td>

    </tr>

  </table>

  <table width="766" border="0" cellspacing="0" cellpadding="3" style="margin: 6px;">

    <tr>

      <td height="48" class="styleFilm">动物总动员(数字3D) (普通话)</td>

    </tr>

    <tr>

      <td height="92" align="center" valign="top" bgcolor="#2F2F2F">

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-40" href="javascript:ParamSubmit('001','11','11号厅','0791005801','动物总动员(数字3D)','2011-07-06','0950','1','01');"

          title="11号厅剩余座位数:104 结束时间:2011-07-06 11:15:00.0">09:50</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-40" href="javascript:ParamSubmit('001','11','11号厅','0791005801','动物总动员(数字3D)','2011-07-06','1130','2','01');"

          title="11号厅剩余座位数:104 结束时间:2011-07-06 12:55:00.0">11:30</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-40" href="javascript:ParamSubmit('001','11','11号厅','0791005801','动物总动员(数字3D)','2011-07-06','1310','3','01');"

          title="11号厅剩余座位数:104 结束时间:2011-07-06 14:35:00.0">13:10</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-40" href="javascript:ParamSubmit('001','11','11号厅','0791005801','动物总动员(数字3D)','2011-07-06','1450','4','01');"

          title="11号厅剩余座位数:100 结束时间:2011-07-06 16:15:00.0">14:50</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-40" href="javascript:ParamSubmit('001','11','11号厅','0791005801','动物总动员(数字3D)','2011-07-06','1630','5','01');"

          title="11号厅剩余座位数:104 结束时间:2011-07-06 17:55:00.0">16:30</a></div>

        <div class="out" onMouseOver="className='over'" onMouseOut="className='out'"><a class="PS001-40" href="javascript:ParamSubmit('001','11','11号厅','0791005801','动物总动员(数字3D)','2011-07-06','1810','6','01');"

          title="11号厅剩余座位数:104 结束时间:2011-07-06 19:35:00.0">18:10</a></div></td>

    </tr>

  </table>
</div>


这样类型的XML怎么解析!

我要的内容是
浙江翠苑电影大世界,假装情侣 (普通话),PS001-25,2011-07-06,18:10

哪位大哥帮帮忙!

[ 本帖最后由 wengold 于 2011-7-5 17:59 编辑 ]
搜索更多相关主题的帖子: 浙江 大世界 
2011-07-05 17:56
dwwwing
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:1
帖 子:284
专家分:986
注 册:2008-10-11
收藏
得分:14 
string str = "xml...";//需要加上个根Root---你给出的是2个根节点
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(str);
                string name = xmlDoc.SelectSingleNode("Root/table/tr/td/span").InnerText;
                string styleName = xmlDoc.SelectSingleNode("Root/div/table/tr/td").InnerText;
                .....其他的自己写下吧
2011-07-05 18:51
快速回复:C# 解析XML
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036277 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved