Thread

Posted on Tue Jan 9 17:39:36 2007 by schaafb
forcearray on attribute
Hi,
We are parsing the following structure and would like to fold the 'source' attribute:
<mc> <transmit source="abc"> <destination level="xxx" status="sss" /> <destination level="yyy" status="ttt" /> ...etc </transmit> <transmit source="def"> ...etc </mc>
For XMLin we use "forcearray => ['destination', 'source'] and keyattr => ['source']".

However with a single 'transmit' (and 'source') element, the 'source' element is not placed in an array and subsequently not folded. Is this the expected behavior? Is there another way to apply forcearray or a similar operation to the 'source' attribute?

Regards,
Benoît
Direct Responses: 4003 | Write a response
Posted on Tue Jan 9 22:08:43 2007 by grantm in response to 3997
Re: forcearray on attribute
The values you give to ForceArray should be element names not attribute names. So in your example, I would expect you want: ForceArray => [ 'transmit', 'destination' ]
Direct Responses: 4109 | Write a response
Posted on Mon Jan 22 14:38:28 2007 by schaafb in response to 4003
Re: forcearray on attribute
Yes, this works! Thanks,
Benoît
Write a response