in reply to Re: extracting href data in XML
in thread extracting href data in XML
use strict; use XML::Twig; my $twig = new XML::Twig(TwigHandlers=> {NBA=>\&NBA}); $twig ->parsefile('nba.xml'); exit<p> sub nba { my ($twig, $nba)=@_; $nba{stadium}= join ':', map {$_->text || ''}@{[$nba->children( 'S +tadium')]; print "$nba(stadium)\n"; $nba ->delete; }
|
|---|