Html 使用xpath选择标记后的第一个标记
我的HTML如下所示:Html 使用xpath选择标记后的第一个标记,html,xpath,Html,Xpath,我的HTML如下所示: <root> <Customer cid= "C1" name="Janine" city="Issaquah"> <input name="Client.ClaimsAdjudicationPendReason" /> <a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudicationPendRea
<root>
<Customer cid= "C1" name="Janine" city="Issaquah">
<input name="Client.ClaimsAdjudicationPendReason" />
<a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudicationPendReason','','')>
<img title="Lookup" class="imgSearchIcon" alt="Lookup" src="/F005web/images/search.gif"/>
<input name="Client.ClaimsAdjudication" />
<a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudication','','')>
<img title="Lookup" class="imgSearchIcon" alt="Lookup" src="/F005web/images/search.gif"/>
</Customer>
</root>
但是我需要选择标签下面的img节点,其中
name="Client.ClaimsAdjudicationPendReason"
原始html缺少了一些内容,请参见我上面的评论。所以假设这就是我们的意图:
<root>
<Customer cid="C1" name="Janine" city="Issaquah">
<input name="Client.ClaimsAdjudicationPendReason" />
<a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudicationPendReason','','')" />
<img title="Lookup" class="imgSearchIcon" alt="Lookup" src="/F005web/images/search.gif" />
<input name="Client.ClaimsAdjudication" />
<a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudication','','')" />
<img title="Lookup" class="imgSearchIcon" alt="Lookup" src="/F005web/images/search.gif" />
</Customer>
</root>
html无效,标记未关闭,并且它们的onclick属性没有右引号。
<root>
<Customer cid="C1" name="Janine" city="Issaquah">
<input name="Client.ClaimsAdjudicationPendReason" />
<a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudicationPendReason','','')" />
<img title="Lookup" class="imgSearchIcon" alt="Lookup" src="/F005web/images/search.gif" />
<input name="Client.ClaimsAdjudication" />
<a onclick="javascript:pendReasonLookup('MFM_Pend Reason', 'PendReason','txtClaimsAdjudication','','')" />
<img title="Lookup" class="imgSearchIcon" alt="Lookup" src="/F005web/images/search.gif" />
</Customer>
</root>
//input[@name="Client.ClaimsAdjudicationPendReason"]/following-sibling::img[1]