mohamedrabeek has asked for the wisdom of the Perl Monks concerning the following question:
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. Mohamedmy $nodeset = $xp->find('//group'); foreach my $node ($nodeset->get_nodelist) { my $attrName = $node->getAttribute('name'); print "name is $attrName\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getAttribute() of XML::XPath::Node
by runrig (Abbot) on Jan 22, 2009 at 17:35 UTC | |
|
Re: getAttribute() of XML::XPath::Node
by holli (Abbot) on Jan 22, 2009 at 17:38 UTC | |
by Herkum (Parson) on Jan 22, 2009 at 18:24 UTC |