0a1,2 > # EDITED by Tina Mueller 2002/03/04 > # see diffSimple.pm for details 70c72 < nsexpand handler Handler); --- > nsexpand handler Handler attrlist); 1129c1131,1144 < if(ref($value) or $self->{opt}->{noattr}) { --- > if(ref($value) or $self->{opt}->{noattr} > # attrlist > or ( > # this has to ask for true instead of exists() > $self->{opt}->{attrlist} > and not exists $ref->{$self->{opt}->{contentkey}} > and > ( > ref $self->{opt}->{attrlist} ne "ARRAY" or > !grep { $_ eq $key } @{$self->{opt}->{attrlist}} > ) > ) > ) { > 1886a1902,1964 > > =item attrlist => 1|[LIST OF ATTRIBUTES] (B) (B) > > This will handle mixed attributes and elements. Suppose you have > the data structure: > { > 'XML' => { > 'ENUM' => { > 'ID' => '23' > }, > 'FIRST' => { > 'A' => 'B', > 'content' => 'Name' > }, > 'ATTRTEST' => { > 'ATTR' => 'test' > } > } > }; > > without attrlist XMLout(keeproot=>1) would give: > > > Name > > > > Now suppose you really need to be ID an element, but "A" > should be an attribute. > > you can use > XMLout($xml, > keeproot=>1, > attrlist => 1, > ); > i > which gives: > > > > 23 > > Name > > test > > > > To specify that ATTR should always be an attribute, say: > print XMLout($xml, > keeproot=>1, > attrlist => ["ATTR"], > ); > > which gives: > > > 23 > > Name > > >