modifiying the extension mechanism in XML schema

I want to suggest an addition to the current specification, to make
defining new types by extending existing ones more flexible.

An example will make clearer the issue I'm addressing.

Say one has the following type definition:

  <xs:complexType name="textType">
    <xs:sequence>
      <xs:element name="paragraph" type="paragraphType"
        maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

and one wants to modify it so that before the sequence of <paragraph> tags
in an instance document there comes a <title> tag.  As things now stand,
because the extension mechanism appends any new parts of the extended
type's content model to the content model of the base type, one would have
explicitly to define a new type:

  <xs:complexType name="textWithTitleType">
    <xs:sequence>
      <xs:element name="title" type="xs:string"/>
      <xs:element name="paragraph" type="paragraphType"
        maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

It seems that it would be more flexible if one could specify whether one
wanted extensions to an existing type's content model to be prepended to
it or appended to it, something like:

  <xs:complexType name="textWithTitleType">
    <xs:complexContent>
      <xs:extension base="textType" insert="prepend">
        <xs:element name="title" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

The "insert" attribute of <xs:extension> could be defaulted to "append",
for backwards compatibility.

Thank you for your consideration.

Yours,
Erik Curiel

Received on Tuesday, 7 January 2003 13:35:57 UTC