Search code examples
htmlxpathhpple

XPath hpple problems objective c


How to find right XPath to this html page, I have a problem with text after symbol « . I use xcode 6 and hpple library. Thanks for answers.

<div class="no_main2">
<div class="margin_main2">
<div class="ww1"></div>   
<div class="content_body2">
<!--Content-->
    <div class="con2">
        <script language="javascript">

</script>
 ....
  <tr>      
    <td align="center" valign="top">
        <!--<img src="/m/12_100229_1_93825.jpg">  -->

          <table border="0" cellspacing="0" cellpadding="0" style="width: 100%">
<tr valign="top">
<td valign="top" style=" width: 100%; ">
<p align="left">
 Text text  text text text text text text text text text</strong>. </p>

  </td>
  </tr>
 </table>
  <table border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
    <tr valign="top">
   <td valign="top" style=" width: 100%; ">
    <p align="left">
 text text text text text text text text text text 
  <br> 
  <br><em>« text text text text text text text text text text text»</em>, -          text text text text text text text text text.
  <br></p>

 ....

Solution

  • If you are asking for the xpath that can locate that element then it is:-

    //em[contains(.,'text')]
    

    now if you want exact text after << then you can refer below referance :-

    http://stackoverflow.com/questions/5756256/trim-spaces-from-end-of-a-nsstring
    

    Hope it will help you :)

    Get back to me if still facing any issue