W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Re: extension and restriction

From: Niko Suave <niko@alum.mit.edu>
Date: Tue, 4 Dec 2001 16:22:30 -0500 (EST)
To: Jeni Tennison <jeni@jenitennison.com>
cc: xmlschema-dev@w3.org
Message-ID: <Pine.LNX.4.21.0112041609210.31520-100000@sub-zero.mit.edu>
Thank you very much!  I am glad to hear that I am beginning to understand
the spec. :)  I have a few more questions / comments that I was hoping to
run by the experts below...

> > If this is correct, then I would like to know how that relates to a
> > wildcard: what if you have a prohibited attribute that would
> > otherwise be allowed by a wildcard? Since it seems that Attribute
> > Uses do not include the option of something being explicitely
> > prohibited, that attribute would presumably be okay.
> 
> I don't understand exactly what you mean here. Are you talking about
> something like:
> 
> <xs:complexType name="base">
>   <xs:attribute name="name" type="xs:string"/>
>   <xs:attribute name="dead" type="xs:boolean"/>
>   <xs:anyAttribute namespace="##other" />
> </xs:complexType>
> 
> <xs:complexType name="extension">
>   <xs:complexContent>
>     <xs:extension base="base">
>       <xs:attribute name="xlink:href" type="xs:anyURI"
>                     use="prohibited" />
>     </xs:extension>
>   </xs:complexContent>
> </xs:complexType>

Hmm, that part of my e-mail didn't make as much sense the second time
I read it.  I see what you mean about the above example being illegal.
I think what I intended was to use restriction than extension like so:

<xs:complexType name="base">
  <xs:attribute name="name" type="xs:string"/>
  <xs:attribute name="dead" type="xs:boolean"/>
  <xs:anyAttribute namespace="##other" />
</xs:complexType>

<xs:complexType name="restriction">
  <xs:complexContent>
    <xs:restriction base="base">
      <xs:attribute name="xlink:href" type="xs:anyURI"
                    use="prohibited" />
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>


Clearly, for 'base' xlink:href is allowed.

For 'restriction,' it seems like xlink:href would also be allowed even
though its prohibited because prohibition merely removes it from the 
attribute use set.  Since it was never in there in the first place, this
has no effect.  Meanwhile, the wildcard "anyAttribute" makes xlink attributes
okay.  

I guess the deeper point I am driving it is that it seems like wildcards and
attribute uses (as well as element rules etc) are completely independent
systems which do not interact when verifying content.  My understanding is
that first the schema checks a given attribute against the attribute use,
and then against the wildcard.  If either says it is okay, then it is.  Is
that reasonable?  I assume the same holds true for element content, to some
degree.  Basically, another way to say this is that the attribute uses cannot
specify what CANNOT be there, only what can.  Is this correct?

thanks again,
niko
Received on Tuesday, 4 December 2001 16:18:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:25 GMT