Sean Mc grath digitome@iol.ie
Mon, 07 Sep 1998 08:20:54 +0100

[Mark Hammond]
>Fredrik and Jack both hit exactly on 2 questions I had.  I would really like
>some comments on them.  Jack asked:
>> I would have used elements only
>> for the BOOKMARK and NODE items,
>> and used attributes for the rest.
>>Can anyone enlighten me which method is best, and why?
>Any comments?  The best I came up with is that attributes require quotes,
>and elements dont??  But logically I agree many of these things are actually
>attributes.  Should they be attributes instead of elements?

The attribute versus element debate is one of the nuggets of the SGML/XML
world. You can express some extra (though rather minor) validity constraints
for attribute values in that they can be one of a pre-defined set of types.

Attribute values can also be layered on at parse-time rather than
added to the document itself. This has a number of very useful applications
culminating in the powerful notion of a document architecture. Lets
leave document architectures alone for now...

Some argue that attributes should only be used for content that is not
logically part of the document. I.e. if it should not disappear when you
strip tags, don't put it in an attribute. Others argue that attributes
are redundant and should be used sparingly if at all. Me? I throw
a small drop of 10 year old Irish Whiskey over my left shoulder
whilst standing on one leg. If one of the little people appear,
I use an attribute, otherewise PCDATA.

>And Fredrik asked:
>>a name element.  Let's see...  Is the following valid syntax?
>I have no idea, and I could not find an answer myself.  Im glad you noticed!
>I am running with it for now :-)
Perfectly valid syntax.

>Sean asked about the CaseOfTheTags??  No one seemed to go with that idea?  I
>kinda like it.
SoDoI. XBEL documents are gonna LOOK REALLY LOUD. all lowercase is, i think
prefereable to all uppcase whatever about camelcase...

>And lastly, the discussion on dates seemed to settle with James indicating
>the XML would look like:
><date scheme="iso-8601">2005-12-01</date>
>But I am unsure what this means to the DTD??

XML parsers do not know anything about dates. You need
to layer on a program that knows about iso-8601. The above is fine
XML markup but you do not get the implied semantic check from XML.

Having said that, this stuff is on the way really soon now. The first
salvo was a Tim Bray propsal for data typing in XML. Then came a formal
submission to the W3C called XML-Data. The latest state of play is
a joint Microsoft/IBM/Tim Bray propsal called DCD. Full info to be
found on W3C.ORG. Me? I use (abuse?) fixed attributes and Python:-

<!ATTLIST date
        value CDATA #REQUIRED
        python-value CDATA #FIXED "Is8601Date">

I have a Python program that kicks in immediately after a parse and hunts
for attributes of the form "python-X". This attribute value is treated
as a Python predicate function and passed the real value of attribute X.
You get the idea. I am not saying this is the way to go. I think DCD
syntax is that way to go because DCD will be built into a bunch of tools
including the Python ones. What I am saying, is that right now,
we have to roll our own validation code for dates.

Sean Mc Grath
+353 96 47391

"Imagine a world without hypothetical situations..."