的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