View Single Post
Old 02-27-2011, 11:06 PM   #27
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Will stay away from JSON then.

Can I use xpath and re:test to grab just the <script> that I want? I tried this and it didn't work:
Code:
root.xpath("//td/script[re:test(., 'szSeries', 'i')]")
That gave me all the <script> tags nested in <td> on the page rather than just the one which contains an szSeries variable. I can test them one by one if need be, but on the surface I thought I could go right to the specific tag I want.

Edit, found an answer:
Code:
root.xpath("//td/script[re:test(text(), 'szSeries', 'i')]", namespaces={"re": "http://exslt.org/regular-expressions"})

Last edited by ldolse; 02-28-2011 at 02:03 AM.
ldolse is offline   Reply With Quote