Re: Shorthand for default attributes (was: Re: Whitespace)

Alex Milowski writes:
 > Hmmm, looks similar to #CURRENT which is in SGML but not in XML.
 > 
 > I have never found a *really good* reason for #CURRENT.  It would seem that
 > #CURRENT is also a "shorthand" for a container.  

There are at least two problems with #current: (1) it is not
hierarchical, and (2) it is in the DTD and not in the document
instance.


 > We want parsing to be easy in XML--not harder because of special cases.  I
 > believe this is one of the reasons why #CURRENT was not included (among other 
 > reasons that we don't need to go over again).

I agree. It is easier to parse if there are no default attributes, and
I like to keep the language as small as possible, but if there are
many elements that need the same attribute value, then specifying that
value in only one place is better in terms of document maintanance: it
helps to avoid errors and is easier to change later.

The trade-off is whether such a mechanism will complicate the
applications. I think declaring defaults for attributes locally, with
scope until the end of the element in which they are declared, is not
complicated to implement (it's a stack, and every parser needs a stack
anyway), while providing a lot of benefit.

For another nice application of default attributes, see
http://www.w3.org/pub/WWW/XML/RDB.html (I started writing about how to
exchange database data with XML some time ago, and then last week Tim
Bray wrote about SQL typing in XML, which turns out to be a very nice
complement to my text.)


 > I like the idea of having the XML at the start of PI.  It gives a processing
 > instruction an pseudo namespace.  I could very easily design an application
 > that "needs" <?default something> for some other reason and now I have
 > conflict with the XML standard.
 > 
 > Generally, I avoid processing instructions as much as possible.  ...but, that
 > is my world, and thus, my opinion.  ;-)

I don't really mind the XML at the start, I was just trying to save a
few bytes:-)

And about your world: I haven't found any applications for PIs either,
and I think that there aren't actually any worlds that need them.

PIs have been suggested for embedding stylistic information into
documents in which people wanted to distinguish between stylistic and
other information. But it turned out that style sheets are much
better.

They have been suggested for `meta-data', i.e., data *about* the
document as opposed to the data contained in the document, but since
PIs lack structure, that didn't work very well either. A link to
external metadata, or even simply a <meta> element, is much better.

As soon as you use PIs, you have to define a syntax for the string
inside the PI. That's stupid, because XML already gives you a nice and
flexible syntax, so why invent another?


Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/pub/WWW/People/Bos/                      INRIA/W3C
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 4 93 65 77 71               06902 Sophia Antipolis Cedex, France

Received on Tuesday, 13 May 1997 14:19:32 UTC