Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Extracting tagged data from a XML file

by davorg (Chancellor)
on Aug 31, 2004 at 10:59 UTC ( #387161=note: print w/replies, xml ) Need Help??


in reply to Re: Extracting tagged data from a XML file
in thread Extracting tagged data from a XML file

It looks like that's what you asked for. I'm not sure what the problem is.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re^2: Extracting tagged data from a XML file

Replies are listed 'Best First'.
Re: Extracting tagged data from a XML file
by theroninwins (Friar) on Aug 31, 2004 at 12:06 UTC
    The problem is that i need every IP only once. (Sorry if i didn't say that before). So i only need to get the IPAddress and not also the NEIGHBOURIPAddress, bacause then i have everything only once.

      If you ever need to get unique values in Perl then you should think about using a hash.

      use XML::XPath; my $xp = XML::XPath->new(filename => '/path/to/file'); my %seen; foreach ('IP-ADDRESS', 'IP-NEIGHBOUR') { foreach my $ip ($xp->findnodes("//$_")) { my $addr = $ip->findvalue('.'); print "$addr\n" unless $seen{$addr}++; } }
      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        Which brings me back to where I was before how do it get XPATH?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://387161]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-06-24 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (80 votes). Check out past polls.

    Notices?