in reply to XML::XPath memory usage

I think you're going to pay quite a high price performance wise. The huge memory consumption at least gives you speed. It's the usual speed/memory trade-off you're facing here and I'm not sure about what performance you'd be left with using a streaming approach.

Just my 2 cents, -gjb-

Update: of course this depends on the amount of queries you want to do against an XML file. Few queries would lend themselves better to a streaming approach, many queries would benefit from a tree approach.