in reply to Re: Problem parsing XML into arrays using XML::Simple
in thread Problem parsing XML into arrays using XML::Simple
I very strongly agree with this approach. You see, you actually have a very well-known and universal problem: you need to fetch particular well-known things out of an XML data structure. You want to be able to do that generically, without creating (and having to constantly maintain) complex procedural code to do so. “XPath expressions” are a perfect way to do that.
So, say goodbye and good day (in this particular case) to XML::Simple. Time to call in his big-brother.
In fact, another technology that you might wish to look into is “XML style sheets (XSL),” which allow you to specify complete XML extractions and transformations, non-procedurally. While the technology is, shall we say, “somewhat obfuscatory,” it is nonetheless very powerful and therefore worth study. I need not bother to say that Perl has excellent support for it. Of course it does... of course...