2014-05-09 48 views
-2

我想寫一個XPath從下面的標籤拉值55.3469,但我不知道從哪裏開始。需要幫助寫一個XpathQueryString

<tr class="uccRes"> 
<td width="47%" align="right" class="leftCol">100.00&nbsp;<span class="uccResCde">ALL</span><!-- This is test data. --> 
</td> 
<td width="6%" valign="middle" align="center">=</td> 
<td width="47%" align="left" class="rightCol">55.3469&nbsp;<span class="uccResCde">AFN</span><!-- This is test data. --> 
</td> 
</tr> 
+0

的[WC3的XPath教程(http://www.w3schools.com/XPath/)好像一個好地方。 – Manhattan

+0

如果您要求提供代碼幫助,請告訴我們您需要的代碼類型(PHP,Javascript,...) – Apolo

+2

另外,如果[已接受的答案](http://meta.stackexchange.com)中有很多問題/問題/ 5234 /如何-不接受-的回答工作)。通過他們,看看是否有任何答案應該被接受。 – alecxe

回答

0

首先找到spanAFN文字和class="uccResCde",然後拿到preceding-sibling

//span[@class='uccResCde' and text()='AFN']/preceding-sibling::text()