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

Re: <group> element's attributes

From: Eddie Robertsson <eddie@allette.com.au>
Date: Tue, 08 May 2001 16:08:35 +1000
Message-ID: <3AF78D61.EBBF2894@allette.com.au>
To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>, XSD <xmlschema-dev@w3.org>

"Henry S. Thompson" wrote:

> We had to choose which took effect, the referring <group ref="..."
> .../>'s min- and maxOccurs, or the referred to's actual group (the
> all/choice/sequence child of <group>).  We decided to go with the
> referring one -- this seems to be what's wanted nine times out of ten,
> although _not_ always -- suggestions for improvements for the next
> version welcome.

That makes sence.
How about solving the problem using presedence so that the minOccurs and
maxOccurs on the <xsd:group ref=".."/> always have higher priority that the
minOccurs and maxOccurs on the child of the group?

For example if you define your group as:

<xsd:group name="myGroup">
    <xsd:sequence minOccurs=1 maxOccurs="5">
        ...
    </xsd:sequence>
</xsd:group>

and you have two references:

<xsd:group ref="myGroup"/>
In this case the minOccurs and maxOccurs on the <xsd:sequence> child above will
apply.

<xsd:group ref="myGroup" minOccurs="1" maxOccurs="1"/>
In this case the minOccurs and maxOccurs on the reference will apply.

Note that in this case you can't use the default values of 1 for minOccurs and
maxOccurs on the reference. Instead you have to look back at the declaration
which is referenced and check the minOccurs and maxOccurs. If they have a value
here these values should be applied, otherwise they should default to 1. I guess
this will complicate the validation though...

A similar solution could be applied to the problem introduced by Michael Gesmann
a couple of days ago:

>"Gesmann, Dr., Michael" wrote:
>
>I'm trying to understand the meaning of "default" and "fixed" when defining
attributes.
>
>This is, what I hope is correct:
>Attribute declarations can define "default" or "fixed" values, independent of
whether it is a global (parent is >schema) or a local (parent is not schema)
declaration. In particular, this is also possible for referencing
>attribute declarations i.e. the "ref" attribute is present (src-attribute). If
referencing and global attribute >declaration have a value constraint and one
describes as fixed value, the other value constraint must also >describe the
same fixed value (au-props-correct.2).
>
>Now my question:
>What is the correct semantics if global and local "default" values are
different?
>
>E.g. <xs:attribute name="myAttr" default="myValue1" .../>
>and in some other place: <xs:attribute ref="myAttr" default="anotherValue"
>... >
>(Is this described in the XML-Schema Rec., if yes where?)

I haven't seen an answer to the question yet and I can't seem to find it in the
spec either. However, this could also be solved by letting the reference take
presedence over the actual declaration. So, in the above example the default
value would be "anotherValue" instead of "myValue1"

Cheers.
/Eddie
Received on Tuesday, 8 May 2001 02:09:42 GMT

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