W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2009

Restricting attribute use from optional to required

From: (wrong string) řidal <jan.pridal@gmail.com>
Date: Fri, 14 Aug 2009 14:41:59 +0200
Message-ID: <b6c018bb0908140541v7481e744q85a5da8b815cbefd@mail.gmail.com>
To: xmlschema-dev@w3.org
Hello all,
my question follows, I am using XML Schema 1.0.

I have an attributeGroup with an optional attribute. This
attributeGroup is used in declaration of complexType. Another
complexType is then an extension of that complexType. Please see my
sample code below.

I would like to declare the attribute 'label' as required for the
'derived' complexType. Is there any legal way to do it?

<xsd:attributeGroup name="attributes">
    <xsd:attribute name="label" type="xsd:string" />

<xsd:complexType name="parent">
        <xsd:attributeGroup ref="attributes"/>

<xsd:complexType name="derived">
        <xsd:extension base="parent">
                <xsd:element ref="parameter" minOccurs="0"
            <xsd:attribute name="name" type="xsd:string" use="required"/>

Jan Pridal
Received on Sunday, 16 August 2009 10:32:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:16 UTC