Array definition in XML? Array definition in XML? arrays arrays

Array definition in XML?


The second way isn't valid XML; did you mean <numbers>[3,2,1]</numbers>?

If so, then the first one is preferred because all you need to get the array elements is some XML manipulation. On the second one you first need to get the value of the <numbers> element via XML manipulation, then somehow parse the [3,2,1] text using something else.

Or if you really want some compact format, you can consider using JSON (which "natively" supports arrays). But that depends on your application requirements.


No, there is no simpler way. You only can lose the type=array.

<numbers>    <value>3</value>    <value>2</value>    <value>1</value></numbers>


Once I've seen such an interesting construction:

<Ids xmlns:id="http://schemas.microsoft.com/2003/10/Serialization/Arrays">        <id:int>1787</id:int></Ids>