W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

PROPOSAL: type assignment based on tag name and presence/absense of attributes

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Thu, 6 Jan 2000 09:46:39 -0700
Message-ID: <00E567D938B9D311ACEC00A0C9B468730C7463@THOR>
To: "'xml-dev@ic.ac.uk'" <xml-dev@ic.ac.uk>, "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Earlier version of XML Schema (http://www.w3.org/1999/05/06-xmlschema-1/) and many existing XML schemas use distinct tagnames for declaration and reference.  The simplification initiative unified the
tag names but at the lost of a substantial degradation of the effectiveness of validation of schema documents.  This proposal recaptures the validation effectiveness of distinct declaration and
reference elements by allowing element to type binding to be conditional on the presence or absense of an attribute.
For example:
<attrGroup name="myattgroup">
	<attrDecl name="name"/>
	<attrDecl name="id"><datatypeRef name="ID"/></attrDecl>
<attrGroupRef name="myattgroup"/>
Since these distinct tag names where associated with different types the content models of the attrGroup and attrGroupRef were different.  You could put a attrDecl in an attrGroup but not in an
The simplification initiative resulted in one tag name that could serve either as a reference or a declaration depending on whether the ref or name attribute was provided.  However this prevents
either DTD or schema processors to detect logically invalid constructs like:
<attributeGroup ref="myattgroup">
	<attribute name="name" type="NMTOKEN"/>
Enhancing the <element> element with additional attributes "withAttribute" and "withoutAttribute" which is the name of an attribute that must (or must not) be present for the association of the tag
name to type be effective.
So for example, attribute would be reworked something like this
<type name="elemDecl" source="annotated" derivedBy="extension">
     <group order="choice" minOccurs="0">
      <element name="datatype" type="anonDatatype"/>
      <element name="type" type="anonType"/>
     <group order="choice" minOccurs="0" maxOccurs="*">
        <element ref="unique"/>
        <element ref="key"/>
        <element ref="keyref"/>
     <attributeGroup ref="typeRef"/>
     <attribute name="equivClass" type="QName"/>
     <attributeGroup ref="occurs"/>
     <attributeGroup ref="valueConstraint"/>
     <attribute name="nullable" type="boolean" default="false"/>
     <attribute name="abstract" type="boolean" default="false"/>
     <attribute name="final" type="boolean" default="false"/>
     <attribute name="exact" type="exactSet"/>

<type name="elemRef" source="annotated" derivedBy="extension">
    <attribute name="ref" type="QName"/>
     <attributeGroup ref="occurs"/>
     <attributeGroup ref="valueConstraint"/>

<!--  the unique keys for element declarations would have to be redone  -->
<element name="element" withAttribute="name" type="elemDecl" equivClass="element"/>
<element name="element" withAttribute="ref" type="elemRef" equivClass="element"/>	


This would allow a schema validator to more effective validate schema documents and other documents that use one tag name in different uses in the same context.  The implementation and performance
cost should be negligable. Explicit definition of the key attributes allows the determination of the proper type to use with only looking at the start element.
Received on Thursday, 6 January 2000 11:48:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:46 UTC