XML: What to use as a list separator
- by Heinzi
There are two ways to specify lists of values in XML. Variant 1:
<Database Name="myDatabase">
<Table Name="myTable1" />
<Table Name="myTable2" />
<Table Name="myTable3" />
...
</Database>
Variant 2:
<Database Name="myDatabase" Tables="myTable1 myTable2 myTable3 ..." />
Clearly, Variant 1 is cleaner and can be extended more easily, but im many cases Variant 2 is more readable and "user-friendly".
When using Variant 2, what should be used as the separator? The XML Schema standard seems to prefer whitespace, whereas some real-world examples use commas instead.
Is there a particular reason to choose one over the other (assuming that the values contain neither whitspace nor commas)?