Derivation by restriction and overriding the use property of an attribute

D

Dietmar Gräbner

Hi

Right now I'm dealing with derivation by restriction and I have some
questions concerning the attribute property use in context of the
derivation.

Consider following Schema:

<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="baseT">
<xs:attribute name="att" use="prohibited"/>
</xs:complexType>

<xs:complexType name="restrictedT">
<xs:complexContent>
<xs:restriction base="baseT">
<xs:attribute name="att" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>

<xs:element name="b" type="baseT"/>
<xs:element name="restr" type="restrictedT"/>

and the valid instance document:

<b att="strange" xsi:type="restrictedT"/>

The strange thing about this schema is the overriding of the Attribute "att"
and setting the attribute use="require". For the intance Document and its
Element "b" this definition means that by using type substitution (with
xsi:type) the attribute required and not prohibited as defined in the base
type. You can see this rather as a type extension instead of a restriction.

The "XML-Schema Part 1: Structures" permits this behaviour. (as I understood
it) The only combination that is not valid is changing a required attribute
to prohibited or optional.

As a validator I used xsv.

my question:

Whats the reason for this sample to be valid?

Perhaps I misunderstood the sense of use="prohibited"?

thx

Helmut
 
P

Priscilla Walmsley

Hi,

That example is not valid. Section 3.2.2 of XML Schema Part 1 says that
if use="prohibited", the "attribute" element corresponds to nothing at
all. This means that "att" is not an attribute of baseT (it is not
among its "attribute uses"), and therefore cannot be restricted in
restrictedT.

I don't think XSV implements all the constraints on restrictions.


Hope that helps,
Priscilla
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top