XML::Twig
am 10.06.2006 00:27:40 von MarieHello, I need some help with the XML::Twig module. The XML documents
that I am working with are rather big and their processing with
XML::Twig is very slow. I would like to use 'twig_roots' or
'twig_handlers' in order to select the parts of the XML documents that
interest me.
Those parts that I want to select are some elements that have attributs
with a certain value. The value that interests me can change during
processing of the document, so at a moment I maybe have to search for
the element with id=3 and then for the element - of the same document -
with id=45 etc.
I would like to know if I could use a variable in the condition
concerning the attribute value (maybe in a regular expression?). For
instance, instead of using the string "BLA", use "$bla" or /$bla/ in
my $twig = XML::Twig->new( twig_handlers => {'attribute[@value="BLA"]'
=> \&function} );
I have already tried that but it didn't work. Thank you in advance for
your help.