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; } }
In reply to Re: Reading/Parsing an XML file using Perl
by GrandFather
in thread Reading/Parsing an XML file using Perl
by manu_06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |