PerlSAX handlers for building tree structures