in reply to Reading/Parsing an XML file using Perl
The following should point you in a useful direction.
#!/usr/local/bin/perl-w use strict; use warnings; use XML::Simple; my @files = ('IMD025350802_000001.xml'); my $xml = XML::Simple->new; for my $fileName (@files) { my $file = $xml->XMLin($fileName) or die "Failed for $fileName: $! +\n"; my $format = $file->{identification}{'identity'}{'format'}; if ($format ne 'JPEG File Interchange Format') { print "Bad format ($format) for $fileName\n"; next; } if ($file->{filestatus}{'well-formed'}{'content'} ne 'true') { print "Content not well formed for $fileName\n"; next; } if ($file->{filestatus}{'valid'}{'content'} ne 'true') { print "Content not valid for $fileName\n"; next; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading/Parsing an XML file using Perl
by manu_06 (Novice) on Sep 17, 2010 at 03:24 UTC | |
by 7stud (Deacon) on Sep 17, 2010 at 06:26 UTC |