in reply to XML::Simple and Adding Nested Elements

From the POD for XML::Simple I found this:

Note 1: The default value for 'KeyAttr' is ['name', 'key', 'id']. If you do not want folding on input or unfolding on output you must setting this option to an empty list to disable the feature.

I think that your problem will go away if you add a KeyAttr=>() in the parameter list as in:

my $xs = XML::Simple->new( ForceArray => 1, KeepRoot => 1, NoAttr => 1, KeyAttr => ());

Rule One: Do not act incautiously when confronting a little bald wrinkly smiling man.

Replies are listed 'Best First'.
Re^2: XML::Simple and Adding Nested Elements
by Ozeroc (Novice) on May 21, 2008 at 13:07 UTC
    That was it! Well, it was actually:
    my $xs = XML::Simple->new( ForceArray => 1, KeepRoot => 1, NoAttr => 1 +, KeyAttr => []);
    ...with square brackets.
    I had read this but I figured you wouldn't need to set a key attribute to empty if you set NoAttr => 1. That's what I get for making assumptions!
    Thanks!

    Rob

      No, KeyAttr e NoAttr refer to completely different things. It is just a bit confusing...

      Rule One: Do not act incautiously when confronting a little bald wrinkly smiling man.