On 6/14/07, Ray <[EMAIL PROTECTED]> wrote:
snip
Oh, one other thing.. What If I wanted to iterate over the "Code" tag
as well? Notice there is 2 Code tags that mean different things. One
is the Customer unique identifier ("LarryBoy") and the other is the
Reject Code ("1234"). I am interested in iterating through the
Customer Code.
Thanks again for your help!
Ray

Do you mean like this?

#!/usr/bin/perl

use strict;
use warnings;

use XML::Simple;

my $xml = XMLin(join "", <DATA>);

for my $rec (@{$xml->{RejectRecord}}) {
       printf qq(customer %-9.9s had error %d "%s"\n),
               $rec->{Customer_New}{Code},
               $rec->{Code},
               $rec->{Reason}
}
__DATA__
<RejectRecords>
       <RejectRecord>
               <Reason>FAILURE: Attempt to add Customer has failed</Reason>
               <Customer_New>
                       <Code>LarryBoy</Code>
               </Customer_New>
               <Code>1234</Code>
       </RejectRecord>
       <RejectRecord>
               <Reason>FAILURE: Attempt to add Customer has failed</Reason>
               <Customer_New>
                       <Code>JimBob</Code>
               </Customer_New>
               <Code>1234</Code>
       </RejectRecord>
</RejectRecords>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to