0

I need extract value of attribute src from this HTML.

For example from this HTML:

<div class="css_telo js_telo">
<div class="css_teloV">
<div class="css_vlavo">
   <div class="css_info css_zena">
      <a class="css_foto big_foto" href="" title="Fotka: endoskopia"><span><img id="PPAsrc" src="http://m3.aimg.sk/profil/v_08c261dabb82e3eaded3e54c28c49e35.jpg?13922246241392224624" width="176" height="220" alt="Fotka: endoskopia" /></span></a><a href="/sluzby/fotka/profilova/?i9=8d6d0b1a0798" class="c_zmenfoto" title="Kliknutím si môžeš zmeniť fotku">Zmeniť fotku</a>
   </div>
   <div class="por_0">
      <div class="css_album css_menubox edit c_prazdne" id="m_fotoalbumy">
         <h3>Fotoalbumy<small> (0)</small></h3>
      </div>
   </div>
   <div class="por_1">
      <div class="css_album c_video xcss_akt css_menubox edit" id="m_videoalbumy">
         <h3>Videoalbumy<small> (0)</small></h3>
      </div>
   </div>
   <div class="por_2">
      <div class="css_priatelia css_menubox edit" id="m_userFriends">
         <h3>Priatelia<small> (0)</small></h3>
      </div>
   </div>
</div>

I need get this:

http://m3.aimg.sk/profil/v_08c261dabb82e3eaded3e54c28c49e35.jpg?13922246241392224624

I tried this XPATH expression:

//div[@class="css_telo js_telo"]/div[@class="css_teloV"]/div[@class="css_vlavo"]/div[@class="css_info css_zena"]/a/span/img/@src

But it not work. Where is problem?

1
  • The image url is broken. Your XPath expression returns a valid result for me, how do you query the HTML snippet and does the original HTML include namespaces? Commented Feb 12, 2014 at 20:18

1 Answer 1

1

it seem like its the only src on the page, you can simply do:

//img/@src

or more specific:

//img[@id="PPAsrc"]/@src
Sign up to request clarification or add additional context in comments.

1 Comment

Strange. I tested your and similar XPATH expressions in haptestbed.codeplex.com not works, but if I tried some online XPATH tester xpath expressions works

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.