I use XML::XQL to extract data from XML blocks. I haven't really needed to build anything really generic yet, so my use so far has been very ad-hoc, grabbing pre-defined parts of the XML block and storing this in the database.
But XML::XQL (and friends) should be a good starting point for you.