- From: John Cowan <cowan@mercury.ccil.org>
- Date: Tue, 18 Dec 2012 05:39:40 -0500
- To: James Clark <jjc@jclark.com>
- Cc: public-microxml@w3.org
James Clark scripsit: > Imagine a really, really simple schema language I like these ideas very much. > An img element must have a src attribute whose value has the url datatype. This lacks a syntax example: perhaps "img @src=url"? > I think you would need to handle attributes as well, which can be done > without too much complexity. Over time I have come to disagree slightly with the RELAX NG style treatment of attributes as fully symmetrical to elements. I know of no SGML-ish processing environment in which unwanted attributes are truly harmful. In general, if you don't take the trouble to look for an attribute, you don't even know it's there. Few programs seem to treat the attributes of an element collectively: either they check for specific attributes, or loop through the attributes dispatching on each one by name (in which case it's typical to say "else do nothing"). Therefore, the unwanted absence of an attribute may be harmful to processing and therefore should be detectable by a validator, but the unwanted presence of an attribute cannot be harmful. Therefore, what counts is to be able to state than an attribute is required. This is the opposite of the TagSoup attitude toward elements, where what counts is to state that a child element is permitted. Taking this attitude also leads to a free-and-easy style of document reuse in which annotators are free to add their own attributes to existing documents for their own purposes, knowing that they will not disturb existing processing, including validation. I hold this to be a Good Thing. > a @ href > > The a element may have an href attribute. I would therefore read this as "The a element must have an href attribute" (of course this is not true in HTML). Arguably you do want to be able to say "If the a element has an href attribute, it must be an URL" (see above). -- Here lies the Christian, John Cowan judge, and poet Peter, http://www.ccil.org/~cowan Who broke the laws of God cowan@ccil.org and man and metre.
Received on Tuesday, 18 December 2012 10:44:22 UTC