Determining when to use an attribute vs. an element
Joined: Apr 05, 2000
I was wondering if there are any rules of thumb/design principles regarding the use of attributes vs. elements to specify data in XML. As an example, below is a snippet of an XML file from an article (citation at the end of the post) and an alternate approach that I came up with that doesn't use attributes to specify the data. From article:
I admit the alternate is probably not the best but I wanted to emphasize the use of elements, not attributes. So is one approach better then the other and if so, why? What says "make this an attribute" vs "make this an element"? The article is The Bean Generation by Claude Duguay in XML Magazine February 2002 v 3 no 1. Thanks, John [ March 01, 2002: Message edited by: John Wetherbie ]
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai