W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2000

Re: Providing a value for attributes defined with use="required"

From: Gino Basso <GBasso@ware2.com>
Date: Fri, 24 Nov 2000 17:31:23 -0500
Message-ID: <8022A77178C84548B49F5965D38776C805F30C@wopr.ware2.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Mike Leditschke wrote:

> I wish to have an attribute which is both required and has a specific
value.

> According to the primer section 2.2, table 1, second row, I should specify
this as

> <attribute name="foo" type="string" use="required" value="r2"/>

To me the two contraints are contradictory (requiring the attribute and only
allowing a fixed value). You might consider the following instead:

    <attribute name="foo" type="string" use="fixed" value="r2" />

Although the appearance of a 'foo' attribute is optional, it's value must be
'r2' if it does appear. Further, if it does not appear a schema processor
will create a 'foo' attribute with this value. This would seem to accomplish
what you want.

BTW, were you using the new beta version (3.5) of XMLSpy to validate your
schema? I wonder to what extent they have implemented the spec?

Regards,
Gino
Received on Friday, 24 November 2000 17:32:27 GMT

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