我有以下格式的XML文件 -
...
<issue-group>
<item id="1">
<variant-group>
<item>
</differences>
</item>
</variant-group>
</issue-group>
<issue-group>
<item id="1">
<variant-group>
<item>
</differences>
</item>
</variant-group>
</issue-group>
<issue-group>
<item id="1">
<variant-group>
<item>
<differences>
<item altered="http://bogus.referer.web.com" original="https://scaling2.stage1.ng.web.net/index.jsp?org_id=59ce35f8-5140-49fb-80ee-9ef950021c3d&space_id=2a9a6f88-f63d-4060-b082-4d260296df04&service_id=8dda6197-0d27-4fd6-aad3-87822345f7d8}" name="Referer" difference-type="changed" difference-element="header" />
<item original="XMLHttpRequest" name="X-Requested-With" difference- type="removed" difference-element="header" />
</differences>
</item>
</variant-group>
</issue-group>
<issue-group>
<item id="1">
<variant-group>
<item>
<differences>
<item altered="BOGUS" original="GET" difference-type="changed" difference-element="method" />
<item original="5daOLNQn4qdJalnHr24aVkiokSows8oOatOZSRty3GglvQRRMB+SYqo1sr0aZ3YJNvNvHpVHgT8AuDC031wjJ54AaHEb+PjLc9xaA6+MH3Jl21mDwmstr/evaizF/4+feIK83apsuRfP8eTFu5H2CkOh2n8Bfm7/Ix+fdQsgs1X+e1H/ZuGP+K1sZOVy4RH8viwPcLRD07uY+iRsFwbmAJ2r9aj++0/ZP4NTPW2Ul8QKAtEAeFU58ePcBy6L/q3c8QQQS1EEz43vzruQbYP+CUNVwjAQ4hO4XdPDJe86DkhT1NrhUQ6Mtk//Yr0e0YkRolCysfQ17TIGJZLhYlz7yE8U9+tKipA427LYzFZUROfI7VBKWuKbDftCL2IP1CdILTRoyLjACCCX3clHt3bm9f3/jhqjTS4MQn/oV9Q3Pss=" name="com.ibm.bluemix.login.Identity.ys1" difference-type="removed" difference-element="cookie" />
<item original="1492597847" name="com.web.net.login.StartTime.ys1" difference-type="removed" difference-element="cookie" />
<item original="0000sj1DBjAukcZlSnEFMyZcC15:8ad9a8a6-4aac-4748-98f6-3db6d6e18701" name="JSESSIONID" difference-type="removed" difference-element="cookie" />
<item original="1492684260" name="com.web.net.login.Expiration.ys1" difference-type="removed" difference-element="cookie" />
</differences>
</item>
</variant-group>
</issue-group>
我需要获取差异节点的数据。我正在使用以下xpath String expressionparameterchanged =“// issue-group / item / variant-group / item / differences / item / @ changed;
它应该返回null,null,http://bogus.referer.web.com,BOGUS
但是只有当条件更改=“无论什么值”存在差异标记时它才会返回值。但如果它不存在则必须返回空值。但它没有这样做。也许可能有一些错误形成xpath。