I am using the getAttribute() method on Node object like given below:
my $nodeset = $xp->find('//group');
foreach my $node ($nodeset->get_nodelist)
my $attrName = $node->getAttribute('name');
print "name is $attrName\n";
My question is that I did not find getAttribute() method defined in XML::XPath::Node module. But it is defined in XML::XPath::Node::Element module. How it is possible to invoke the getAttribute on the Node object instead of Element object. I am getting the results for the above code snippet. My question is why getAttribute() of Element.pm is called when I invoke the method on the Node object. In other words what is the relationship between Node and Element.I don't think inheritance kicks in here because Element is the child of Node and not the Node is the child of Element.
Thanks in advance for your replies.