Jump to content
UBot Underground

Need A Little Xpath Help


Recommended Posts

can someone tell me how to isolate just the $14.99
 
 
  <p class="sale-price">
                    
                        $14.99
                        <span class="sale-was-price">
                            <s>$24.99</s>
                        </span>
                        <span class="sale-tag">Sale</span>
                    
                </p>

Link to post
Share on other sites
set(#newline,$replace("<p class=\"sale-price\">
                    
                        $14.99
                        <span class=\"sale-was-price\">
                            <s>$24.99</s>
                        </span>
                        <span class=\"sale-tag\">Sale</span>
                    
                </p>",$new line,$nothing),"Global")
alert($find regular expression(#newline,"(?<=<p class=\\\"sale-price\\\">  ).*(?=<span class=\\\"sale-was-price\\\">)"))

I dont know this will help you or not but I could not do it with xpath praser.

Link to post
Share on other sites

yes i know i can read in the document text and regex to list,

but that defeats the purpose of this exersise, as you can see the class atributes all share something "sale" or "price"

what i need to learn is how to call just the eliment that i want,

but thanx for the help :) :)

thats why i love this place, folks aint shy about helping to work out a problem

Link to post
Share on other sites

You can't extract only the first one just with Xpath.

 

Because the innertext for the element <p class="sale-price">  is one "object".

So it will return the complete thing.

 

But in Ubot it's easy.

 

Use xpath to get the innertext

//p[@class="sale-price"]

 

trim it

add to list

use first list item

 

Dan

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...