Monday, August 30, 2010

Beer or wine, elements or attributes? Designing XML schemas

Example of a XML fileImage via Wikipedia
One of the questions asked repeatedly during DB2 pureXML workshops is about the use of elements and attributes when designing XML documents/schemas. What is better, using elements or attributes?

The answer given is that it depends on the data, the requirements, and other factors. Instead of going deeper into the reasoning for elements and attributes, I am referring to the summary at Cover Pages. Michael Kay has already in 2000 put the entire discussion into the following wise words found here:
Beginners always ask this question.
Those with a little experience express their opinions passionately.
Experts tell you there is no right answer.