element content vs. element attribute

David Megginson ak117 at freenet.carleton.ca
Sun Dec 21 11:58:20 GMT 1997

Ray Waldin writes:

 > In other words, when should data be contained by elements?  Or
 > conversely, when should data be an attribute of an element instead
 > of contained by that element?

Here's a good, general distinction:

* use elements for structurally-significant information; and

* use attributes for meta-data.

One problem, that will become more obvious when more XML tools are
available, is that most WYSIWYMG (M="might" or "may") XML editing
software will like show character data (element content) on the screen
by default, but will show attributes only on request, possible in a
pop-up dialog.  It makes sense to have the most important information
(the real content) inside elements, then, and to have the meta-data
out of the way in attributes.

(Peter: how do you display attributes in Jumbo?)

Of course, what is and isn't meta-data will vary depending on the
document type, but here are some common examples:

* a unique identifier
* a security level
* a revision or release level
* rendition information (yech)
* configuration information
* the preferred unit of measurement

All the best,


David Megginson                 ak117 at freenet.carleton.ca
Microstar Software Ltd.         dmeggins at microstar.com

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list