Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)

by choroba (Abbot)
on Apr 02, 2013 at 11:15 UTC ( #1026658=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
in thread Some issues with WWW::Mechanize::Firefox->xpath() method

You are using findnodes, but there is no node corresponding to the substring. Use find instead:

print for $dom->find(q{ substring(//p,1,4) });
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^4: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
Select or Download Code
Re^5: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
by Corion (Pope) on Apr 02, 2013 at 11:30 UTC

    For reference, WWW::Mechanize::Firefox uses document.evaluate() to execute an XPath query. I don't know how it relates to ->findNodes and ->find, but the return value will always be DOM nodes.

    Javascript in MozRepl::RemoteObject:

    ... var xres = doc.evaluate(q,ref,null,XPathResult.ORDERED_NODE_SNAPSHOT_T +YPE, null ); ...
Re^5: Some issues with WWW::Mechanize::Firefox->xpath() method (xpath 1.0)
by Anonymous Monk on Apr 02, 2013 at 11:35 UTC

    You are using findnodes, but there is no node corresponding to the substring. Use find instead:

    Well that certainly works :) but the explanation doesn't make sense to me -- what is a text literal if not a text node?

    This whole time I've been thinking the two functions were interchangeable, if findnodes can't deal with this, it should reject the xpath, not do nothing, but yeah, I'm confused

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026658]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-09-23 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls