Hi,

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" }

In reply to Reading/Parsing an XML file using Perl by manu_06

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.