in reply to Re^2: Naive idea : using XSH with WWW::Mechanize::Firefox, to make faster XPath queries ?
in thread Naive idea : using XSH with WWW::Mechanize::Firefox, to make faster XPath queries ?

i lose the advantage of WWW::Mechanize::Firefox
You don't. Navigate with Mechanize, parse/query with TreeBuilder.
  • Comment on Re^3: Naive idea : using XSH with WWW::Mechanize::Firefox, to make faster XPath queries ?

Replies are listed 'Best First'.
Re^4: Naive idea : using XSH with WWW::Mechanize::Firefox, to make faster XPath queries ?
by mascip (Pilgrim) on Feb 06, 2012 at 19:58 UTC

    As said here 951038 by Corion :
    "WWW::Mechanize::Firefox only works with Firefox. There is no way to make HTML::TreeBuilder::XPath objects work with it."

    WWW::Mechanize::Firefox->xpath() returns MozRepl::RemoteObject, which are i think internal (to Firefox) Javascript objects.
    While HTML:TreeBuilder::XPath returns and deals with HTML::Element, which are extracted from the HTML source, and thus don't take Javascript into account.
    Is that right?

    I am still curious about the utility of using both XPath and Tree. Is it any different from using a Tree on its own?

      PS : i'll try to use HTML::TreeBuilder::LibXML and see what difference it makes with a tree in terms of :
      - algorithm;
      - language fluidity and readability ( shall i call this "poetry" ? );
      - speed;
      and report my results here.