in reply to Re: XML::XPath Question
in thread XML::XPath Question

That's not what the docs say, and that's not what the error message says. (It mentions "Node", not "NodeSet".)

The error message is actually spot on. The OP is trying to call the "exists" method of a node, but nodes don't have an "exists" method. The correct usage is

$tree->exists('path', $node)

Replies are listed 'Best First'.
Re^3: XML::XPath Question
by Corion (Patriarch) on Nov 10, 2010 at 20:30 UTC

    I was looking at <a href="http://search.cpan.org/~msergeant/XML-XPath-1.13/XPath.pm#findnodes%28$path,_$context%29">->findnodes, and there it says that.

    But I remember hours of staring at various parts of the documentation, trying to piece together a whole, so there might be other parts that say something else.

      I don't get it.. a tree is still basically a node, and vice versa... what sets them apart?

        No. A tree is an organization of nodes. And to search that tree, you have to employ the "XPath searcher" that lives in XML::XPath. You can't intermix methods from the searcher and the tree.

        No. Trees and XML::XPath objects are not nodes, and node objects are not XML::XPath objects. Trees have a node for root, and nodes belong to a tree. There are no is-a relationship between the two, just has-a relationships.
Re^3: XML::XPath Question
by TendulkarIsGod (Acolyte) on Nov 10, 2010 at 20:39 UTC

    I'm sorry, but I don't get it, but a node is a tree, and vice-versa.. what is the distinction?