in reply to Re^5: Compare 2 XML files
in thread Compare 2 XML files
#!/usr/bin/env perl use strict; use warnings; use XML::XPath; use Data::Dumper; my @records; my @eventrecords; my $eventxml = 'events.xml'; my $evenxp = XML::XPath->new(filename => $eventxml); my $evennodeset = $evenxp->findnodes('//event'); my $xml = 'ApplicationList.xml'; my $xp = XML::XPath->new(filename => $xml); my $nodeset = $xp->findnodes('//application_list'); foreach my $evennode ($evennodeset->get_nodelist) { my $evenssrid = $evenxp->find("./custom_attribute_list/custom_ +attribute[normalize-space(name)='SSRID']/value", $evennode); s/^\s+|\s+$//g for $evenssrid; push @eventrecords, {eventid => $evenssrid}; } print Dumper \@eventrecords; foreach ($xp->findnodes('/application_list/application/@id') ) { my $appid = $_->string_value; $appid =~ s/^\s+|\s+$//g; push @records, {appid => $appid }; } print Dumper \@records;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Compare 2 XML files
by poj (Abbot) on Jul 10, 2017 at 14:43 UTC | |
by snehit.ar (Beadle) on Jul 11, 2017 at 05:29 UTC | |
by snehit.ar (Beadle) on Jul 11, 2017 at 05:53 UTC | |
by huck (Prior) on Jul 11, 2017 at 06:02 UTC | |
by snehit.ar (Beadle) on Jul 11, 2017 at 06:50 UTC | |
| |
by poj (Abbot) on Jul 11, 2017 at 07:08 UTC | |
by snehit.ar (Beadle) on Jul 11, 2017 at 07:20 UTC | |
| |
|
Re^7: Compare 2 XML files
by Corion (Patriarch) on Jul 10, 2017 at 13:50 UTC |