Restricting a union? was RE: Schema for schemas bugs?

I think this is a related question:  
Is it possible to derive a simpleType by restriction from a union simple
type, 
such that the derived type selects just one of the primitivetypes from the
union?  

For example, starting with a "supertype"

  <simpleType name="TMDurationType">
    <union memberTypes="duration positiveInteger double"/>
  </simpleType>

can this be restricted to "duration" only?  

N.B. 
  <simpleType name="TMPeriodDurationType">
    <restriction base="gml:TMDurationType">
      <simpleType>
        <restriction base="duration"/>
      </simpleType>
    </restriction>
  </simpleType>

is prohibited according to clause 3 
of 4.1.3 Constraints on XML Representation of Simple Type Definition
http://www.w3.org/TR/xmlschema-2/#defn-rep-constr

"Schema Representation Constraint: base attribute or simpleType child 

Either the base   [attribute] or the simpleType  [child] of the
<restriction> element must be present, but not both. "


Why would I want to do this, you may ask?  
I want to put various versions of "duration" into a single substitution
group.  

_____
[This mail represents part of a discussion of work in progress 
and should not be used for any purpose without my permission.] 
_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon

> -----Original Message-----
> From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
> Sent: Tuesday, 23 April 2002 4:28 PM
> To: Aung Aung
> Cc: xmlschema-dev@w3.org; www-xml-schema-comments@w3.org
> Subject: Re: Schema for schemas bugs?
> 
> 
> "Aung Aung" <aaung@microsoft.com> writes:
> 
> > The issues with the  xsd4xsd in MSXML are, 
> > 
> >  
> > 
> > 1. There were some confusion in the beginning about the usage of
> > anySimpleType. After some clarification, we allow anySimpleType as a
> > type name. However,  the spec also said "simple *ur-type definition*
> > <http://www.w3.org/TR/xmlschema-1/#key-urType#key-urType>  
> must not be
> > named as the *base type definition*
> > 
> <http://www.w3.org/TR/xmlschema-1/#st-base_type_definition#st-
> base_type_
> > definition>  of any user-defined simple types: as it has no 
> constraining
> > facets, this would be incoherent." So, how are all the 
> primitive data
> > types have restriction facets on anySimpleType. Spes does 
> not say how it
> > allows it. Do we have to special-case all primitive dataType as
> > restrict-able from anySimpleType exclusive to for parsing 
> xsd4xsd (for
> > such confusing issue, spec should implicit about how to 
> approach it.)?
> 
> Sorry for the confusion -- you're right that the inclusion in the
> sForS of the 'information only' definitions of the builtin primitive
> datatypes is problematic.  I would note in our defense that the quote
> above says you can't have anySimpleType as the {base type def} of and
> _user-defined_ types, but I agree that taken as a user schema doc.,
> the published sForS violates this constraint.
> 
> The _reason_ these defns are there is so that for _all_ builtin types
> there is a well-grounded URL of the form
> 
>    http://www.w3.org/2001/XMLSchema.xsd#typename
> 
> but with hindsight we perhaps should have buried all these defns
> inside <xs:documentation>.
> 
> > 3. Explicit declaration such as
> > xmlns:xml=http://www.w3.org/XML/1998/namespace is now allowed by the
> > namespace spec. It is explicitly stated in the xml spec 
> that xml:lang
> > (http://www.w3.org/TR/2000/REC-xml-20001006#sec-lang-tag) 
> is a special
> > attribute to allow language specification in XML, it need 
> not xmlns:xml
> > declaration.  
> > 
> > [2] 
> > 
> > PrefixedAttName
> > 
> > ::= 
> > 
> > 'xmlns:' NCName
> > 
<http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName#NT-NCName> 
> 
> [ 
> 
> NSC: Leading "XML"
> <http://www.w3.org/TR/1999/REC-xml-names-19990114/#xmlReserved#xmlReserv
> ed>  ]
> 
> Namespace Constraint: Leading "XML"
> Prefixes beginning with the three-letter sequence x, m, l, in any case
> combination, are reserved for use by XML and XML-related specifications.

Microsoft has consistently maintained that this prose allows parsers
to raise an error when confronted by the correct declaration
'xmlns:xml="http://www.w3.org/XML/1998/namespace"'.  Most of the rest
of the implementor community have read it as allowing _only_ this
declaration for that prefix, while not requiring it.  I believe there
will soon be an erratum clarifying this.

> 4. should remove the trailing space in version [version="Id:
> XMLSchema.xsd,v 1.48 2001/04/24 18:56:39 ht Exp "]. Because it is typed
> as toke, which cannot have trailing space.

It's not a token at all -- this is just a bug and will be fixed.

> 5. Some group reference that already mentioned in other threads.

Indeed.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged
spam]

Received on Friday, 26 April 2002 00:10:43 UTC