Embedding Content as Element Content or As An Attribute Value

David Megginson ak117 at freenet.carleton.ca
Fri Jan 9 16:56:48 GMT 1998

Michael Kay writes:

 > I think Marcus is wrong. The domain of application of SGML is
 > different from the domain of application of XML, and the
 > distinction between attributes and content which made sense in the
 > SGML world is extremely perplexing to those with a background in
 > data modelling and data structure design in other domains, who are
 > legitimate members of the XML community.

You are absolutely right.  The problem is that XML uses a
fundamentally different approach to data modelling than that used in
the relational world, and people accustomed to mapping their data onto
two-dimensional tables may have trouble getting used to the idea that
XML data structures (like those in object-oriented databases) can be
hierarchical, repeatable, and even recursive or circular.

 > In the DTD I've been designing, for what it's worth, I'm currently
 > using content for nearly everything, with very little use of
 > attributes. The main reason is for future extensibility; elements
 > can always acquire a richer internal structure, while attributes
 > can't. The drawbacks (e.g. inability to specify any constraints on
 > values, default values, etc) don't actually lose me much, because
 > the constraints available for attributes are very limited anyway.

This is a good approach.  Even in SQL, the built-in constraints have
little use: nearly everyone needs to write middleware to enforce
complex business rules that cannot be captured by the standard types
and constraints; likewise, XML implementations need middleware to
enforce business rules for their content, while the XML parser may
validate the structure.

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