15

I have a malformed page to scrape, and have had a hard time getting the correct XPath for YQL. I can scrape individual fields that I need using, for example:

//*[@id="cell_12345"]

But what I really need to do is return all elements who's ID begins with cell_. Something like:

//*[@id="cell_"*]

How do I do this?

Also, if anybody can point me to a good XPath reference it would be very helpful.

Thanks!

user191688
  • 2,609
  • 5
  • 26
  • 30

1 Answers1

30

Something like

//*[starts-with(@id, 'ceil_')]

should do nicely.

As for an xpath reference, once you know the syntax and the axis, just any old function reference should help. This was the first one google: http://www.w3schools.com/xpath/xpath_functions.asp

Paul Tarjan
  • 48,968
  • 59
  • 172
  • 213
  • Any idea how to fecth image and meta description from amazon.in/Seiko-Premier-Analog-Blue-Watch/dp/… ? –  Jun 29 '17 at 11:59