W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Re: Conditional typing

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Mon, 11 Feb 2002 10:53:15 +0100
Message-ID: <3C67948B.10604@dyomedea.com>
To: Piccand Régis <regis.piccand@imtf.ch>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Piccand Régis wrote:

> - Is this possible to do that in the actual version of xmlschema ?

It is impossible if you want to use a "type" attribute from your own 
namespace, but (almost) exactly what xsi:type has been designed for!

See for instance http://www.w3.org/TR/xmlschema-0/#UseDerivInInstDocs

The problem which you will have is that since xs:base64Binary and 
xs:string are both 2 primary types, you will have to use a generic UR 
type for the definition of your element and will not be able to control 
that other types are not used in addition of those two.

> - If not, is it planned to allow this kind of functionality ?
> - Is it recommended to use "non-standard" schema languages (schematron ??) ?

If you don't want (ot can't) use "xsi:type" instead of your "type" 

attribute, yes you can use schematron but it won't be that easy to test 

if it's a valid base 64 content with Schematron. 

What you can also do is to embed a schematron rule in a W3C XML schema 
with xsi:type to check that one of the two allowed datatypes is used.

Another option is to use RELAX NG instead of W3C XML Schema.

Hope this helps.


Rendez-vous a Paris pour mes formations XML/XSLT.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
Received on Monday, 11 February 2002 04:54:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:59 UTC