W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2007

Schema for mixed content to provide backwards compatibility for an element with changing from complex type to simple type

From: William S Fulton <wsf@fultondesigns.co.uk>
Date: Thu, 30 Aug 2007 21:43:32 +0100
Message-ID: <46D72BF4.1030904@fultondesigns.co.uk>
To: xmlschema-dev@w3.org

I'd like to upgrade our usage of XML dates to use the XML date type and 
be able to validate both the old and new xml elements. An example of our 
current xml date element looks like:


The desired change to use the xs:date type would look like:


Is it possible to create a schema which will fully validate both 
versions of the date element? I've been experimenting and googling for 
some while now and cannot find a solution to getting a suitable schema. 
I'd like to avoid changing the name of the element from "date". The 
following mixed content will validate both, but it will validate any 
text instead of the XML date type, which isn't very good:

<xs:complexType name="DateType" mixed="true">
   <xs:sequence maxOccurs="1" minOccurs="0">
     <xs:element name="day" type="integer" />
     <xs:element name="month" type="integer" />
     <xs:element name="year" type="integer" />

Received on Friday, 31 August 2007 11:40:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:13 UTC