【发布时间】:2013-10-09 00:08:39
【问题描述】:
我需要获取一些复杂的 XML 就像:
<Response xmlns="http://somewhere/somewhere/">
<Params>
<Param>
<Name>some data</Name>
<Value xmlns="">abcdedsfeesfxyz0123456789</Value>
</Param>
<Param>
<Name>Target</Name>
<Value xmlns="">xml</Value>
</Param>
<Param>
<Name>Platform</Name>
<Value xmlns="">Mobile</Value>
</Param>
</Params>
<Results>
<Groups>
<Group>
<Key>ABCWXYZ0123456789</Key>
<TotalCount>1208</TotalCount>
<Useful>...</Useful>
</Group>
</Groups>
</Results>
</Response>
对我有用的数据在<Useful>...</Useful>
然后我尝试获取第一层:
String returnXML = client.DownloadString(strUrl);
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(returnXML);
XmlNode xmlData = xdoc.SelectSingleNode("Response");
xmlData中没有数据
谢谢
【问题讨论】: