W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2012

Re: Override a type in a schema

From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
Date: Wed, 7 Mar 2012 13:46:18 -0700
Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, xmlschema-dev@w3.org
Message-Id: <3AB2E874-41EC-47CF-A1D3-DCCD0B51BA8E@blackmesatech.com>
To: Andrew Welch <andrew.j.welch@gmail.com>

On Mar 7, 2012, at 10:10 AM, Andrew Welch wrote:

> Given an element:
> <theirs:foo>
> and an XSD for the 'theirs' namespace defining foo as xs:string, how
> can I override that definition with my own type?  One way is:
> <theirs:foo xsi:type="my_type_for_foo">
> Is there a 1.0 way to do it without using xsi:type ?

One way is:  Write your own schema document for the 'theirs' 
namespace, assign the type of your choice to 'foo', and point your 
software at your schema document for the namespace.  

Plus:  very simple.

Minus: you end up duplicating all of their declarations, 
and if they perform maintenance you don't get those fixes.
(Unless you automate the production the schema document
by writing a simple transform to take their schema document
and replace the appropriate element declaration, leaving
everything else as is.)

Plus and/or minus:  if you do it this way, the type you 
provide does not need to be either a restriction or an 
extension of xs:string.  That's a distinct plus, except in cases
where it's a distinct minus.  And vice versa.  YMMV and
you have been warned.  Void where prohibited by law, etc
etc etc.


* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
Received on Wednesday, 7 March 2012 20:46:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:01 UTC