in reply to A sane method for parsing deeply nested XML
Another, more-general solution is to use XPath expressions, as implemented by some of the packages such as XML::LibXML. (This particular package invokes an industry-standard C library for handling XML.)
The advantage of this approach is that the expression describes what you want to retrieve, and it’s up to the library to give you the result. The structure of your application logic no longer has to match the structure of the XML ... sort of like the difference between a hand-crafted recursive descent compiler vs. using a grammar system like YACC. If your XML is complicated, deeply-nested, variable and so forth, then that’s what is “sane” to me.