anniyan has asked for the wisdom of the Perl Monks concerning the following question:
Monks, in twig_handlers i am using a path $epath as shown below to change the 'title' tag into 'tit'.
In order to access the 'title' tag i am giving such long path, i know we can give just 'title' alone to access via partial_path. But i want to know whether we can give something like 'gutbook/*/title' means gutbook followed by any elements and finally title, else is there anyother way to ignore the element names inbetween.
$epath = 'gutbook/book/frontmatter/titlepage/title'; my $twig = XML::Twig->new( twig_handleres => { '$epath' => \&normal} ); $twig->parse(\*DATA); __DATA__ <gutbook> <book> <frontmatter> <titlepage> <title>THE ILIAD</title> <author>HOMER</author> </titlepage> </frontmatter> <bookbody> <chapter> <title>BOOK I</title> <para> Sing, O goddess, the anger of Achilles son of Peleus, that brought countless ills upon the Achaeans. </para> </chapter> </bookbody> </book> </gutbook>
Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: xml::Twig partial_path question
by Tanktalus (Canon) on Nov 23, 2005 at 18:38 UTC |