On 07/26/2006 02:44 PM, BW wrote:
I'm not sure that I was completely clear on my
description. As I go through the Dumper output, I
have a different name/entry for each occurence of the
{changing element name} element. I'm looking for
recommendations regarding how to handle such
occurrences.
[...]
You handle them the way you'd handle any hash reference. You
iterate over the keys:
use strict;
use warnings;
my $xml = new XML::VeryComplex (KeyAttr=>[]);
my $data = $xml->XMLin(join '',<DATA>);
my $variable = $data->{dataschema}{attributes}{attribute};
print "attribute:\n";
foreach my $key (keys %$variable) {
print qq{ $key => "$variable->{$key}"\n};
}
exit;
package XML::VeryComplex;
use base 'XML::Simple';
package main;
__DATA__
<dataschemas>
<dataschema name="defaultDB">
<includes>
<include name="Base Metadata"/>
<include name="Extracted Re-Map"/>
</includes>
<attributes>
<attribute category="" parser="TextParser"
extract="true" segmentation="soft"/>
</attributes>
</dataschema>
</dataschemas>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>