best practice for xml repeating elements -


is acceptable repeat xml elements shown in example? notice in first example how 'period_data' element repeated directly inside 'usage_history' element without first being wrapped inside 'periods' parent element.

initially seems reduant me include 'periods' parent element thing inside 'usage_history' parent 'period_data' elements anyway.

thank you.

<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> 

as opposed this...

<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> 

yes. fine. there no need enclosing element.

i num_periods="2" wrong, period_data elements should account themselves.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -