by Nick
Monday, June 02, 2008 11:42 AM
Coding Horror recently went after XML as being a rather poor option for many things. I generally don't agree with that sentiment, but I do agree with the idea that there is good XML structure and bad. Here is an example of bad XML structure that is required to use a control library from Janus. This sample XML snippet is required to define the columns in their grid control:
<Columns Collection="true">
<Column0 ID="">
<Caption>Home Term</Caption>
<EditType>NoEdit</EditType>
<Position>0</Position>
<Width>73</Width>
</Column0>
<Column1 ID="Column1">
<Caption>Driver</Caption>
<EditType>NoEdit</EditType>
<Key>Column1</Key>
<Position>1</Position>
</Column1>
<!-- ... -->
</Columns>The controls so far look rather nice, and fairly functional and complete. At issue here is the use of tag names like "Column0" and "Column1". A well designed XML structure would just have "Column" tags, and then use some sort of extra identifier... which ironically... they already do! Yet they require that the tag name matches the identifier. Definitely not a good use of XML's inherent structure and definition abilities.