的XPath时,我有以下XML:凭证无效的错误使用与命名空间
<ns:response xmlns:ns="http://example.com" xmlns:ax="http://example.com/xsd" >
<ns:return type="mytype">
<ax:roleID>1</ax:roleID>
<ax:roleName>ADM</ax:roleName>
</ns:return>
<ns:return type="mytype">
<ax:roleID>2</ax:roleID>
<ax:roleName>USR</ax:roleName>
</ns:return>
</ns:response>
将为获得所有角色名XPath表达式(ADM,USR)是什么样的?
这不是工作:
ns:response/ns:return/ax:roleName ns http://example.com ax http://example.com/xsd
当我使用它,我得到的异常
'NS:响应/ NS:返回/斧:ROLENAME NS http://example.com斧头http://example.com/xsd' 有令牌无效。
我实际上使用XPathNodeIterator:XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator nodeIter = nav.Select(expression); – jwaliszko 2010-07-22 14:49:47