XSchema Spec Section 2.4, Draft 2
crism at oreilly.com
Wed Jun 24 23:01:05 BST 1998
> <!ELEMENT XSC:AttDef (Doc?, (CData | ID | IDRef | IDRefs | Entity |
> Entities | NmToken | NmTokens | NotationType |
> EnumerationType),(Required | Implied | Fixed | AttValue))>
> <!-- Name is the name of the attribute -->
> <!ATTLIST XSC:AttDef name NMTOKEN #REQUIRED >
[First of all, all those child elements need namespace qualifiers.]
This seems unnecessarily verbose in the extreme. What's wrong with
<!ELEMENT XSC:AttDef (XSC:Doc?)>
Name NMTOKEN #REQUIRED
Type (CData |
Required (Yes |
Fixed (Yes |
Enumeration NMTOKENS #IMPLIED
Default CDATA #IMPLIED>
The name is the name of the attribute.
The type is the type of the attribute; if the type is Notation or
Enumeration, then the enumeration attribute is required.
The required attribute takes "yes" or "no"; "yes" is the same as
#REQUIRED; "no" is the same as #IMPLIED.
For the fixed attribute, "yes" is the same as #FIXED, and "no" is the
same as its absence.
The enumeration attribute takes a list of tokens (since only tokens
can be given in an enumerated list).
The default value is just that; it must comply with whatever type was
Here's where it gets interesting: Does XSchema have to limit itself to
the capabilities of DTDs? If so, why bother? Think about this:
<XSC:AttDef Name="one-of-these" Type="IDRef" Required="Yes"
Enumeration="index biblio gloss"/>
You can't do that with DTDs. The value for one-of-these must be
specified, and it must be a legitimate IDREF, but it is constrained to
one of the specific IDs listed.
Another example that someone in this group (one of the Peters?) raised
is default ID names. This is illegal in XML 1.0, but for my <index>
element, nine times out of ten, the ID is "index".
<!-- whatever content model -->
<XSC:AttDef Name="id" Type="ID" Default="index"/>
> <!-- XSC:CData through XSC:EnumerationValue identify attribute types -->
> <!ELEMENT XSC:CData EMPTY>
> <!ELEMENT XSC:ID EMPTY>
> <!ELEMENT XSC:IDRef EMPTY>
Any time you have a huge slew of EMPTY elements, think that maybe they
should be attributes.
> In XSchema 1.0, an attribute declaration (XSC:AttDef element) must
> be nested within the element declaration (XSC:ElementDecl element)
> for the element to which the attribute belongs.
This gives less functionality than XML DTDs, since you can have
multiple ATTLISTs for one element type. XSchema should provide that;
ElementType NMTOKEN #IMPLIED>
If the AttDef specifies an ElementType, it applies to the named
element type. If not, and it is contained in an ElementDecl, then it
applies to that element type; otherwise it is an error.
And BTW, I still don't like this capitalization method. I'm all for
<xsc:attdef>; I do all my coding by hand (and so will everyone else,
until an XSchema editor is written; don't hold your breath).
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>
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;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev