Re: Override a type in a schema
"C. M. Sperberg-McQueen" <[email protected]>
| Newsgroups | gmane.text.xml.schema.devel |
|---|---|
| Message-ID | <[email protected]> |
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. hth -- **************************************************************** * C. M. Sperberg-McQueen, Black Mesa Technologies LLC * http://www.blackmesatech.com * http://cmsmcq.com/mib * http://balisage.net ****************************************************************