element content vs. element attribute

David Megginson (ak117@freenet.carleton.ca)
Sun, 21 Dec 1997 06:55:42 -0500


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

-- 
David Megginson                 ak117@freenet.carleton.ca
Microstar Software Ltd.         dmeggins@microstar.com
      http://home.sprynet.com/sprynet/dmeggins/

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