in reply to Re^6: Compare 2 XML files
in thread Compare 2 XML files
Yes, and parse the application ids first
poj#!/usr/bin/env perl use strict; use warnings; use XML::XPath; use Data::Dumper; my $xml = 'ApplicationList.xml'; my $xp = XML::XPath->new(filename => $xml); my %appid = (); for ($xp->findnodes('/application_list/application/@id') ) { my $id = $_->string_value; $id =~ s/^\s+|\s+$//g; $appid{$id} = 1;; } print Dumper \%appid; my $eventxml = 'events.xml'; my $evenxp = XML::XPath->new(filename => $eventxml); my $xpath = "//event/custom_attribute_list/custom_attribute[normalize- +space(name)='SLB_SSRID']/value"; my @eventrecords = (); foreach my $node ($evenxp->findnodes($xpath)) { my $ssrid = $node->string_value; $ssrid =~ s/^\s+|\s+$//g ; if ( exists $appid{$ssrid} ){ push @eventrecords, { eventid => $ssrid }; } } print Dumper \@eventrecords;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Compare 2 XML files
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 huck (Prior) on Jul 11, 2017 at 09:31 UTC | |
by poj (Abbot) on Jul 11, 2017 at 07:08 UTC | |
by snehit.ar (Beadle) on Jul 11, 2017 at 07:20 UTC | |
by poj (Abbot) on Jul 11, 2017 at 08:06 UTC | |
| |
by snehit.ar (Beadle) on Jul 12, 2017 at 13:04 UTC | |
|