best practice for xml repeating elements

mongneverdied

New Member
Is it acceptable to repeat xml elements as shown in this example? Notice in the first example how the 'period_data' element is just repeated directly inside the 'usage_history' element without first being wrapped inside something like a 'periods' parent element.Initially it seems reduant to me to include the 'periods' parent element as the only thing inside the 'usage_history' parent are 'period_data' elements anyway.Thank you.\[code\]<usage_history num_periods="2"> <period_data billing_year="2013" billing_period="2"> content... </period_data> <period_data billing_year="2013" billing_period="1"> content... </period_data></usage_history>\[/code\]as opposed to this...\[code\]<usage_history> <periods num_periods="2"> <period_data billing_year="2013" billing_period="2"> content... </period_data> <period_data billing_year="2013" billing_period="1"> content... </period_data> </periods></usage_history>\[/code\]
 
Back
Top