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

Re: Simple question on elements constraints

From: Francis Norton <francis@redrice.com>
Date: Wed, 24 Jan 2001 18:49:19 +0000
Message-ID: <3A6F23AF.FDCCEF4E@redrice.com>
To: Morris Matsa <mmatsa@us.ibm.com>
CC: xmlschema-dev@w3.org
My mistake - you're absolutely correct about "fixed" and "default"
applying to element declarations
(http://www.w3.org/TR/2000/CR-xmlschema-1-20001024/#declare-element -
then scroll down a page). This only applies if they have schema as their
parent. I'd love to know why these don't apply to locally declared
element declarations?

You're thinking quite a long way ahead with your points below. In this
case Adalbert Wysocki used base="xsd:string" in his sample, so I did
too. In general I would expect the requirement to be that the
appropriate equality testing for the data type be used, but XML Spy for
one appears to use string matching right now for enumerations over
xsd:integer, for instance "+3000" != (xsd:integer) "3000" (I couldn't
find a way of writing two valid, semantically equivalent but lexically
different dates - any suggestions?). I failed to find anything in the
spec about whether enumeration validation should use string or semantic
matching.

Presumably a schema-validating parser would contribute the "fixed" value
even for an empty element or attribute. Do any of the currently
available schema validation tools demonstrate the infoset contribution
features of XML Schema, rather than just the validation?

Francis.


Morris Matsa wrote:
> 
> On the first point:  David Cleary had made the assumption that the desire
> was for an integer which happened to be 3000.  Adalbert Wysocki will have
> to tell us if this is fundamentally an integer or a string.  If it is an
> integer, and David is right, then it's probably better to derive from
> integer as David did so that it's obvious to all Schema tools, and then he
> would have to use a pattern restriction to avoid allowing other forms of
> the number 3000 (of course Adalbert will also have to tell us if he minds
> those.  I made that assumption.)  If it's really a string, then I agree
> that the best solution is restriction string with an enumeration as Francis
> Norton did below.
> 
> On your second point:  I don't see anything at your link saying that
> "fixed" and "default" apply only to attributes.  I believe that they apply
> to elements as well, see [1].
> 
> [1] http://www.w3.org/TR/xmlschema-1/#Element_Declaration_details
>
Received on Wednesday, 24 January 2001 13:52:03 GMT

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