XML读取问题
这是我的XML
string XmlResult = " <?xml version= "1.0 " encoding= "gb2312 "?> "+
" <POIContext> "+
" <POI ID=\ "B000A23A0E\ " POIName=\ "金库KTV\ " phoneNumber=\ " \ "> "+
" <POIAttributeList> "+
" <POIInfoList> "+
" <POIInfo name=\ "pguid\ " value=\ "B000A23A0E\ " /> "+
" <POIInfo name=\ "name\ " value=\ "金库KTV\ " /> "+
" <POIInfo name=\ "srctype\ " value=\ "basepoi\ " /> "+
" <POIInfo name=\ "gridcode\ " value=\ "5916639010\ " /> "+
" <POIInfo name=\ "address\ " value=\ "北京市西单堂子胡同9号新一代大厦810层\ " /> "+
" <POIInfo name=\ "tel\ " value=\ " \ " /> "+
" <POIInfo name=\ "x\ " value=\ "loremmjnuiuNGEK\ " /> "+
" <POIInfo name=\ "y\ " value=\ "nwjpkggkvnuJOEK\ " /> "+
" <POIInfo name=\ "imageid\ " value=\ " \ " /> "+
" <POIInfo name=\ "citycode\ " value=\ "010\ " /> "+
" </POIInfoList> "+
" </POIAttributeList> "+
" </POI> "+
" <Distance value=\ "0\ " uom=\ "M\ " /> "+
" </POIContext> "+
" </POIInfoList> ";
这是代码
XmlDocument xmldot = new XmlDocument();
xmldot.LoadXml(XmlResult);
XmlNodeList nodeList = xmldot.SelectNodes( "//POIInfo ");
node).Attributes[ "name "].Value;
node.ChildNodes;
foreach (XmlNode childNode in nodeList)
{
TextBox2.Text = ((XmlElement)childNode).Attributes[ "value "].Value;
}
为什么只能得到 "010 ",而不能把value的值都得出来,哪个地方有错,还有我只想得到
<POIInfo name= "x " value= "loremmjnuiuNGEK " />