stevensun has asked for the wisdom of the Perl Monks concerning the following question:
****************************************************** the xml file is:use strict; use XML::Twig; use XML::XPath; use XML::XPath::XMLParser; my $twig= new XML::Twig( TwigHandlers => { product => \&product } ); + $twig->parsefile("file.xml"); my @height = $twig->get_xpath ('//measure[string(c093)="01"]'); #if i + want to get the length
<message> <product> <measure> <c093>01</c093> <c094>229.0</c094> <c095>mm</c095> </measure> <measure> <c093>02</c093> <c094>152.0</c094> <c095>mm</c095> </measure> <measure> <c093>03</c093> <c094>15.0</c094> <c095>mm</c095> </measure> <measure> <c093>08</c093> <c094>24</c094> <c095>oz</c095> </measure> </product>
20060311 Janitored by Corion: Added code tags around code and data
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: question on XML Twig and XPath query
by Aristotle (Chancellor) on Mar 11, 2006 at 07:08 UTC | |
by stevensun (Initiate) on Mar 14, 2006 at 08:07 UTC |