in reply to Re: XML::Simple $elt->noattr is there an equivalent using XML::Twig
in thread XML::Simple $elt->noattr is there an equivalent using XML::Twig

Thanks, KeepRoot works fine, but is for XML::Simple only..

The example works OK ( need to use $elt->{att'}->{$att} for a value though ) - is this the same as the method 'att_to_field' ?

( I think so having looked at the code but would like to confirm still being a newbie )

Thanks

  • Comment on Re^2: XML::Simple $elt->noattr is there an equivalent using XML::Twig

Replies are listed 'Best First'.
Re^3: XML::Simple $elt->noattr is there an equivalent using XML::Twig
by mirod (Canon) on Mar 01, 2006 at 13:59 UTC
    need to use $elt->{att'}->{$att} for a value though

    Actually $elt->att( $att) is what you want, to use an accessor instead of assuming that the attributes are in a hash (they are) and will always be (there is no guarantee about that anywhere in the docs). (end of the rant ;--)

    is this the same as the method 'att_to_field'

    Yes it is! And I had completely forgotten about this method. Thanks for reminding me of its existence. That will teach me to write more methods than can fit in my head.