Embedding Content as Element Content or As An Attribute Value
Sean Mc Grath
digitome at iol.ie
Sun Jan 11 19:54:59 GMT 1998
>Michael Kay wrote:
>> the XML community. Philosophically - at least in terms of any
>> ontological system I am aware of it is a nonsense....
[Paul Prescod]
>
>You've missed the point that attributes have an important feature w.r.t
>extensibility. An unknown attribute just disappears in processing, since
>they are named by role. In every XML/SGML processing system I am aware
>of (including XML DTDs, DSSSL, XSL and probably SAX), it is harder to
>handle unknown elements because their GI could represent either their
>role or their object type.
Attributes have a couple of other "attributes" that feature in the list of
pragmatics.
1) An attribute is associated with an element type and typically communicated
as such by parsers. Thus you do not need to establish a context in processing
software. One less piece of state-space.
Say element types foo and bar have an attribute "n" and we wish to print out
its value for foo elements only.
We have this (in pseudo-something)
:
element foo {
print attributes["n"]
}
Rather than this:
element n {
if parent == "foo"
print GetDataDescdendants()
}
2) Attributes can be added without changing the instance. This is a sort of "out
of line linking" that allows new layers of meaning to be added to elements
perhaps
years after the content has been created. Although this approach has its limits,
it can be hugely useful as Eliot Kimber et. al. have demonstrated on this list
many times.
It will be possible, I imagine, to do this sort of on-the-fly layering with
sub-elements
rather than attributes in, say, XMLData. But the attribute approach just
feels right
somehow:-)
Final comment:
I think the most exasperating thing for classically trained data modellers
approaching
SGML/XML is that a lot of the established terminology of the field pops up
meaning
completly different things. vis. Entity/Attribute modelling. Argh!
Sean Mc Grath
sean at digitome.com
Digitome Electronic Publishing
http://www.digitome.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