in reply to error : can't locate object method "getAttribute" via package XML::DOM::NodeList

Where do you find the method ->getAttribute documented for a XML::DOM::NodeList? It doesn't make sense to ask for the attributes of a list. Maybe you want to extract the first item from that list and ask for its attribute?

  • Comment on Re: error : can't locate object method "getAttribute" via package XML::DOM::NodeList
  • Download Code

Replies are listed 'Best First'.
Re^2: error : can't locate object method "getAttribute" via package XML::DOM::NodeList
by ankit.tayal560 (Beadle) on Sep 27, 2016 at 08:55 UTC

    http://search.cpan.org/~tjmather/XML-DOM-1.46/lib/XML/DOM.pm : in XML::DOM classes section goto XML::DOM::Element. there it is documented. and config is itself an element/tag infact it is the root element of the .xml file?

      Yes, that function makes sense and is documented for an XML::DOM::Element. But what ->getElementsByTagName returns is not a single XML::DOM::Element object. Please refer to the SYNOPSIS section of XML::DOM to see the correct usage.

        can you please provide me some code to parse this xml file and get the different attributes?