A Design Issue for this Example Markup Language

A problem that often plagues beginning designers is whether some some aspect of their design should be implemented as an element (tag) or as an attribute. A general rule to use is this:

If the item in question is a component or part of a whole, then make it an element. If the item characterizes an element and, potentially, all its sub-elements, then it should be an attribute.

In some cases, the decision is obvious. In HTML, <li> is an element, since a list item is clearly a part of the bigger <ol> or <ul>. Similarly, type= is an attribute, as the numbering or bullets characterize the list and all of its items.

For the weather report example given in this article, the question arose as to how to handle the <station> element. I thought of the fullname and abbrev as identifiers, so they naturally became attributes. I then rationalized that latitude and longitude should be elements, since:

  1. The location is what really makes the station a unique station.
  2. I needed an example of an element that had both attributes and sub-elements.