manu_06 has asked for the wisdom of the Perl Monks concerning the following question:
I have bunch of XML files where using perl I have to read each file one by one and check certain tag values and if the values do not match print the filename and tag name to an output file. My script below is checking the the tag values and printing match or not match. Now I got stuck with how to print the filename and tag name if there is no match and also instead of single file declaration a path should be declared so that it can read all the files. Can I get some help regarding this.
#!/usr/local/bin/perl-w use XML::Simple; my $xml = XML::Simple->new; my $file = $xml->XMLin('IMD025350802_000001.xml') or die$!; if (($file->{identification}{'identity'}{'format'} eq 'JPEG File Inter +change Format') && ($file->{filestatus}{'well-formed'}{'content'} eq 'true') && ($file->{ +filestatus}{'valid'}{'content'} eq 'true')) { print "match"; } else { print "not match" }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Reading/Parsing an XML file using Perl
by GrandFather (Saint) on Sep 17, 2010 at 00:34 UTC | |
by manu_06 (Novice) on Sep 17, 2010 at 03:24 UTC | |
by 7stud (Deacon) on Sep 17, 2010 at 06:26 UTC | |
Re: Reading/Parsing an XML file using Perl
by toolic (Bishop) on Sep 17, 2010 at 00:24 UTC | |
by manu_06 (Novice) on Sep 17, 2010 at 00:45 UTC | |
by rowdog (Curate) on Sep 18, 2010 at 09:11 UTC |