Embedding Content as Element Content or As An Attribute Value

Michael Kay M.H.Kay at eng.icl.co.uk
Mon Jan 12 11:34:38 GMT 1998


-----Original Message-----
From: Paul Prescod <papresco at technologist.com>
To: xml-dev at ic.ac.uk <xml-dev at ic.ac.uk>
Date: 11 January 1998 15:50
Subject: Re: Embedding Content as Element Content or As An Attribute Value


Paul Prescod wrote, inter alia:
>I'm surprised, though that you would claim that the distinction between
>"hasproperty" and "containsobject" is missing in every ontological
>system you are aware of. 

That distinction is certainly one of the traditional difficulties of all
data modelling, and thanks, yes, it's helpful to see it in those terms.
But I don't think the XML/SGML distinction between attributes and
content is quite the same. If we consider the difference between:

<PIZZA PRICE="$12.00" DESC="Ham and mushroom"/>
versus
<PIZZA PRICE="$12.00">Ham and Mushroom</PIZZA>

then the distinction is not between an attribute and a contained
object, but between "ordinary" attributes and one "special" attribute
which we call the content of the object. The ontological systems
I am aware of do not treat one of the attributes of an object as being
special in this way.

In fact the representation I am using is more like:
<PIZZA>
  <PRICE>$12.00</PRICE>
  <DESC>Ham and mushroom</DESC>
</PIZZA>

In other words, I am treating all the attributes as "contained objects",
and the reason I am doing this is that in my particular domain, 
some of the attributes may carry additional information (sometimes
called "facets") e.g. where did this information come from, how
reliable is it, and when did it last change.

I apologize for my faux-pas in the suggestion that the scope of
application of XML was wider than that of SGML. I had forgotten,
of course, that to SGML insiders SGML is applicable to 
everything - it is only outsiders who draw boundaries
around it :-)

PS: can I ask for some advice? In my DTD for the above, I want 
to say that the element PIZZA has no immediate character 
content other than ignorable white space. I feel sure it must 
be possible to say this, but I haven't found out how.

The alternative seems to be disallow character content entirely,
and generate documents using a layout such as:

<PIZZA
  ><PRICE>$12.00</PRICE
  ><DESC>Ham and mushroom</DESC
></PIZZA>

but I find it hard to believe this is what the designers
intended.

Mike Kay


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