I had to use an combination of GroupTags and then ValueAttr
my $ref = XMLin($jdf,GroupTags => { LayerList => 'LayerDetails' },
ValueAttr => [ LayerList => 'Name' ] );
thanks
On 19-jan-06, at 12:43, John Doe wrote:
Bjorn Van Blanckenberg am Donnerstag, 19. Januar 2006 09.33:
I have some elements in my xml that are empty but have attributes.
I would like that I can group the element in function of Attribute
Name.
<Layout Class="Parameter" ID="r060116_103344354_000026"
Status="Available">
<LayerList>
<LayerDetails Name="nl-BE"/>
<LayerDetails Name="fr-BE"/>
<LayerDetails Name="nl-NL"/>
</LayerList>
</Layout>
I read in I get
$VAR1 = {
'ID' => 'r060116_103344354_000026',
'Status' => 'Available',
'LayerList' => {
'LayerDetails' => [
{
'Name' => 'nl-BE'
},
{
'Name' => 'fr-BE'
},
{
'Name' => 'nl-NL'
}
]
},
'Class' => 'Parameter'
};
I would like it when the xml is readed in to became
{
'ID' => 'r060116_103344354_000026',
'Status' => 'Available',
'LayerList' => {
'LayerDetails' => [ 'nl-BE', 'fr-BE',
'nl-
NL' ]
},
'Class' => 'Parameter'
}
}
I've tried to use
# KeyAttr => [ list ]
# KeyAttr => { list }
# GroupTags => { grouping tag => grouped tag }
even an combination of KeyAttri and GroupTags but don't get the
desired output
Just in case it's not possible with XML::Simple, you could use a
workaround on
the result data structure by transforming it with:
$VAR1->{LayerList}->{LayerDetails}=
[ map {%$_} @{$VAR1->{LayerList}->{LayerDetails}} ];
hth, joe
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>