我可以在Xpath中执行此操作,但不幸的是,对于此特定项目,我无法使用xpath。在.NET中读取xml ref属性
我有以下节点选择:
<client href="http://somewebsitehere.com" rel="needthisdata"></client>
clientnode.Attributes["href"].Value
正确返回 “http://somewebsitehere.com”,但
clientnode.Attributes["rel"].Value
不起作用?
我在这里做错了什么?
全部使用:
foreach (XmlNode clientnode in clientnodelist)
{
MessageBox.Show(clientnode.Attributes["rel"].Value);
}
上面给出了一个NullReferenceException,而使用的 “href” 代替 “相对” 正常工作。
我敢肯定,我已经选择了正确的节点,以及比赛的innerText,以及attribute.count返回2.
它如何不正常工作?你收到异常或返回一些错误的值? – 2010-11-30 19:29:53
''行是否正确? –
BeemerGuy
2010-11-30 19:31:17