in reply to Need an hash of the Parsed Document !
If you need to get attributes as well, like the values in 'CreationDate' then you will have to do a bit more work:sub parsing { my ( $twig, $account ) = @_; my @tags = qw( Id OwnerFirstName OwnerLastName ); my %hash = map { $_ => $account->findvalue($_) } @tags; validate( \%hash ); } sub validate { my ( $hash ) = @_; if ( $hash->{'Id'} eq 'abcd' ) { print "Id $hash->{'Id'} is valid\n"; } else { print "Id $hash->{'Id'} is not valid\n"; } }
my @cdates = $account->findnodes('CreationDate'); my $cdate = $cdates[0]; $hash{'date'} = join('-', $cdate->att('day-of-month'), $cdate->att('mo +nth'), $cdate->att('year') );
|
|---|