Try to run it first.
I had even though I didn't need to do so in this case. I'm quite familiar with what KeyAttr does.
And I'm quite familiar with how to use it properly. "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." (empahsis mine). Said list is passed in an array ("KeyAttr => [ list ]").
As whether that's the desired result, I would rather allow different opinion here.
The OP is quite clear what he wants from the second XML snippet ("I would like to have an output like below"). Running
your code produces the exact same output as without KeyAttr for this snippet.
With default KeyAttr:
$VAR1 = {
'type' => {
'report' => 'Dummy1',
'name' => 'default'
}
};
With empty KeyAttr:
$VAR1 = {
'type' => {
'report' => 'Dummy1',
'name' => 'default'
}
};
Not only did you not fix what the OP asked for you to fix, you broke the code for the case where it used to work. The OP is quite clear that he's "getting proper result" for the first XML snippet. The result you attached shows you broke that.
|