in reply to Extracting tagged data from a XML file
Using the proper tools (an XML parser, not regular expressions), it becomes pretty simple:
use XML::XPath; my $xp = XML::XPath->new(filename => '/path/to/file'); foreach ('IP-ADDRESS', 'IP-NEIGHBOUR') { foreach my $ip ($xp->findnodes("//$_")) { print $ip->findvalue('.'), "\n"; } }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting tagged data from a XML file
by theroninwins (Friar) on Aug 31, 2004 at 10:30 UTC | |
by jeffa (Bishop) on Aug 31, 2004 at 13:44 UTC | |
by theroninwins (Friar) on Sep 01, 2004 at 09:03 UTC | |
|
Re: Extracting tagged data from a XML file
by theroninwins (Friar) on Aug 31, 2004 at 10:45 UTC | |
by davorg (Chancellor) on Aug 31, 2004 at 10:59 UTC | |
by theroninwins (Friar) on Aug 31, 2004 at 12:06 UTC | |
by davorg (Chancellor) on Aug 31, 2004 at 12:15 UTC | |
by theroninwins (Friar) on Aug 31, 2004 at 12:35 UTC | |
| |
by theroninwins (Friar) on Aug 31, 2004 at 13:26 UTC |