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

C#调用webservice接口的问题,谢谢了
<?xml version="1.0" encoding="utf-8" ?> 
- <root>
  <P Yball="友誼賽,GO,80,1:0,中國[23][主],科特布斯(德國),,*,,0.900,1/1.5,0.960,294667,,,,,,," /> 
  <P Yball="馬來西亞超級聯賽,GO,<fontstyle=background-color=red>中場</font>,0:1,砂勞越[主],雪蘭莪,0.800,*0.5,1.000,0.990,2.5,0.810,293761,,,,,,," /> 
  <P Yball="埃及聯賽,GO,41,0:2,巴拉蒂耶[主],薩瓦赫爾,0.860,*0/0.5,1.020,1.140,3.5,0.720,294647,,,,,,," /> 
  <P Yball="馬來西亞超級聯賽,GO,25,1:0,玻璃市[主],彭亨,0.840,0.5/1,0.960,0.900,3,0.900,293755,,,,,,," /> 
  <P Yball="馬來西亞超級聯賽,GO,26,0:0,吉打[主],PDRM,1.000,1,0.800,0.950,3,0.850,293757,,,,,,," /> 
  <P Yball="馬來西亞超級聯賽,GO,25,0:1,檳城[主],丁加奴,0.900,*0.5/1,0.900,0.980,2.5/3,0.820,293759,,,,,,," /> 
  <P Yball="馬來西亞超級聯賽,GO,22,0:0,柔佛[主],汶萊DPMM,0.650,0/0.5,1.150,1.000,2,0.800,293763,,,,,,," /> 
  <P Yball="馬來西亞超級聯賽,GO,26,0:0,森美蘭[主],PB-MyTeam,0.960,0/0.5,0.840,0.900,1.5/2,0.900,293765,,,,,,," /> 
  <PK uptime="2007-12-18 21:13:02" /> 
  </root>


这是我的WebService接口上某个函数会返回的值. 现在是,我怎么读取到这里面的值

读取所有Yball的值

------解决方案--------------------
foreach (XmlNode xn in doc.GetElementsByTagName("P"))
{
xn.Attributes["Yball"].Value;
}