Next in thread → Next in month →

Re: [xml-dev] XML Schema Question: specifying restrictions for a list of elements

From
Thomas B. Passin <>
To
Date
2004-04-07T14:49:04Z
ID
<>
Thread
Re: [xml-dev] XML Schema Question: specifying restrictions for a list of elements
Eric van der Vlist wrote:
> On Wed, 2004-04-07 at 14:51, Tom Gaven wrote:
>>You can interleave ('&' connector) the single 'computer with default
>>attribute' with one or more 'computers without default attribute'.
> 
> 
> Very nice.
> 
> What is needed here is probably to require one default attribute equal
> to "true" and others either missing or equal to "false", but your schema
> can easily be adapted:

Seems to me that you can just declare the attribute "default" to be of 
type ID.  That requires its value to be unique.  Then create a 
restriction so that it can only accept the value "true".  Finally, make 
the attribute's presence optional.  Now you are allowed to use it, but 
it must have the value "true" and that value may only appear once.

This method ought to be easier and more interoperable than using "key".

Of course, this won't work if you want to also include many attributes 
default='false'.

Cheers,

Tom P
Next in thread → Next in month →