W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2004

redefining attribute groups for controlled extensibility

From: Xan Gregg <xan.gregg@jmp.com>
Date: Tue, 14 Sep 2004 11:11:44 -0400
Message-Id: <63BC6E11-0660-11D9-97BE-000A95B51846@jmp.com>
To: xmlschema-dev@w3.org

I finally figured out where <redefine> came from: it reproduces one of 
the uses of internal parameter entities in DTDs where you can override 
the definition of an IPE that was part of an ATTLIST, say, to augment 
the content of an element declaration.

For a use case, consider the XML Schema for the CDISC ODM standard [1], 
which is a format for exchange of clinical trials data.  The schema 
allows for vendor extensions as long as there is type information 
available for the extensions.  It does this by means of strict 
wildcards in ##other namespace.  Complete validation of any instance 
document is important for this group.

The problem with the strict wildcards sprinkled throughout is that any 
global attribute can go in any element.  There's no way to say a 
particular vendor-added attribute can only go on a particular element, 
which is a problem in practice.  A vendor defines extension attributes 
and then is surprised to see them in unexpected places while the user 
says, "it's valid according to the schema".

A better solution, I realize, would be to use redefinable attribute 
groups, which would allow the vendor to specify which attributes are 
allowed where.  Instead of a wildcard, the original schema should 
define an attribute group for each element.

  <xs:attributeGroup name="ItemDefAttrs">
  <!-- redefine this group to add vendor extensions to the corresponding 
element  -->

   <xs:element name="ItemDef">
       <xs:sequence>...  </xs:sequence>
       <xs:attributeGroup ref="ItemDefAttrs"/>

The vendor attributes are defined in a vendor schema document and 
pulled into a redefining schema:

  <xs:import namespace="http://www.vendor.org/" 
  <xs:redefine schemaLocation="ODM.xsd">
      <xs:attributeGroup name="ItemDefAttrs">
          <xs:attributeGroup ref="ItemDefAttrs"/>
          <xs:attribute ref="ven:Label"/>
          <xs:attribute ref="ven:DisplayFormat"/>

If this scheme is used throughout the original document, the vendor 
attribute will be allowed on the target element and only on the target 

This is a pretty straightforward use of redefine/attributeGroup, but it 
hadn't occurred to me as a planned extensibility mechanism.


[1] http://www.cdisc.org/models/odm/v1.2/index.html
Received on Tuesday, 14 September 2004 15:11:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:24 UTC