I didn't notice XML::Rules last time I browsed CPAN. Thanks for the tip. I'm currently using XML::Twig, for two reasons.
- The files I have do not fit into main memory. (Well, they would, if I bought another gigabyte of RAM.) XML::Twig is able to parse the file one part at a time, without loading it all in at once.
- I like the concept of twigs much more than SAX.
Another gain is that (as with SAX?) I can store the absolute byte position of where certain elements start and where they end, by defining a start_twig_handler and calling current_byte, which is defined in XML::Parser::Expat. I am using this to load big data chunks from the file on-demand. The data chunks are the real culprits in why I can't read in the whole file at once. Storing hundreds of megabytes of base64 encoded binary data in an XML file is not my idea, though... But I have to live with it.
Anyway, this is going too much on a tangent. I'm beginning to think Hash::CamelCase is pretty useless. Maybe I should move the module to the Acme namespace.