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

Re: Redeclaring attribute in derived type

From: Jesse McCarthy <mccarthy36@earthlink.net>
Date: Fri, 21 Dec 2001 10:20:12 -0500
To: jeni@jenitennison.com, xmlschema-dev@w3.org
Message-ID: <MWMail.aonpraea@host.none>
Jeni Tennison <jeni@jenitennison.com> wrote on 12/21/01 10:09:53 AM:
>I don't see anything stopping you from doing that - it would have the
>same effect as a fixed value constraint, in terms of validation,
>though it wouldn't report the same PSVI.

You mean I will have to include the attribute in the instance document, 
correct? 

>I think the reason that ID attributes aren't permitted value
>constraints is that it would easily lead to two elements having the
>same ID, which is of course illegal in XML. But I can see that there
>might be uses for it - if you wanted to make sure that you only ever
>had one element of that particular type in the document, for example.

That was the only rationale I could imagine.  That is exactly the use I have 
in mind -- to ensure that there is only a single element of the given type in 
the document. 

>When you ask "Why?", what kind of response are you after? Do you want
>to have the constraints from the Rec quoted so that you can see why I
>say you have to use two steps, or do you want to know the reasons
>behind the way XML Schema is designed?

See below.

>When you restrict, the {attribute uses} of the derived type contains
>all the {attribute uses} from the definition of the derived type, plus
>any of the {attribute uses} from the definition of the base type that
>have not been overridden by {attribute uses} from the derived type. So
>you don't end up with duplicate attribute declarations because the
>attribute declaration of the id attribute in the base type is not
>added to the {attribute uses} of the derived type.
>
>Look at the way that the {attribute uses} property is defined in the
>XML Schema Rec, in Section 3.4.2
>http://www.w3.org/TR/xmlschema-1/#declare-type.

OK, I got you.  I overlooked that, now I understand the reason for the 
(awkward) two step approach.  I think it's not even worth the trouble of 
using the base type in this case.  I'll keep your tip about the order of 
extension / restriction in mind in case I do take this approach at some point.
 

By the way, what software would you recommend for schema validation, either 
locally or online?  For obvious reasons I have lost confidence in the XSV 
validator available via the web. 

Thank you Jeni.

// Jesse
Received on Friday, 21 December 2001 10:46:15 GMT

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