RE: [Updated] XML Schema 1.1 Tutorial

> 108 shows an xsd:alternative element with an inline simple type 
> definition.  This is not strictly speaking illegal or 
> impossible, but since the element in question is being handled with 
> conditional type 
> assignment it will typically have attributes, and if it has any 
> attributes, it won't be legal against any simple type.  So a simple 
> type will be a possible alternative type only when the tests are 
> rather unusual.  The use of a simple type is most plausible if all the 
> tests relate to some inherited attribute.
> 

Another plausible scenario is for one alternative to be a complex type with
simple content (where an attribute exists) and for another alternative to be
a simple type (where the attribute doesn't exist). I'm not quite sure if
that works, without checking the detailed rules, but it's a reasonable
scenario. It could arise where version 1 of a schema had
<weight>200g</weight>, and version 2 retains that format for backwards
compatibility, but also allows <weight units="g">200</weight>

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

Received on Thursday, 30 July 2009 13:11:12 UTC