日期:2014-05-18  浏览次数:20478 次

求助!关于xpath 检索XML的问题!!
各位:
我用xpath   语句是:
    ds   =   xmlTool.GetData( "//m[@l=\ "欧洲联赛冠军杯\ "] ");
想提取所有的l=“欧洲联赛冠军杯”的节点。
语句已经成功!但是在ds中只有一行数据。是我xpath写的不对,还是下面的提取方法有问题。提取方法:
————————————————————————————————
public   DataSet   GetData(string   XmlPathNode)
                {
                                                DataSet   ds   =   new   DataSet();
                        StringReader   read   =   new   StringReader(objXmlDoc.SelectSingleNode(XmlPathNode).OuterXml);
                        ds.ReadXml(read);
                        return   ds;
                }
————————————————————————————————————


XML格式是:
——————————————————————————————————
  <?xml   version= "1.0 "   encoding= "gb2312 "   ?>  
  <g>
  <s>
    <m   i= "218057 "   l= "新加坡职业联赛 "   c= "#FF99CC "   a= "雅龙联 "   b= "卡沙 "   d= "2007,07,31,19,45 "   tv= " "   as= " "   bs= " "   ah= " "   bh= " "   ar= " "   br= " "   st= "未开赛 "   />  
    <m   i= "234837 "   l= "欧洲联赛冠军杯 "   c= "#F75000 "   a= "佩历克 "   b= "萨克达 "   d= "2007,07,31,23,00 "   tv= " "   as= " "   bs= " "   ah= " "   bh= " "   ar= " "   br= " "   st= "未开赛 "   />  
    <m   i= "234795 "   l= "友谊赛 "   c= "#003333 "   a= "华登舒特 "   b= "波琴 "   d= "2007,08,01,00,00 "   tv= " "   as= " "   bs= " "   ah= " "   bh= " "   ar= " "   br= " "   st= "未开赛 "   />  
    <m   i= "234839 "   l= "欧洲联赛冠军杯 "   c= "#F75000 "   a= "谭柏利 "   b= "索菲亚利夫斯基 "   d= "2007,08,01,00,00 "   tv= " "   as= " "   bs= " "   ah= " "   bh= " "   ar= " "   br= " "   st= "未开赛 "   />  
    <m   i= "234797 "   l= "友谊赛 "   c= "#003333 "   a= "费雷堡 "   b= "卡斯鲁厄 "   d= "2007,08,01,00,15 "   tv= " "   as= " "   bs= " "   ah= " "   bh= " "   ar= " "   br= " "   st= "未开赛 "   />  
 
   
    </s>
    </g>
————————————————————————————————————

------解决方案--------------------
ds = xmlTool.GetData( "//m[@l=\ "欧洲联赛冠军杯\ "