- From: Morris Matsa <mmatsa@us.ibm.com>
- Date: Tue, 23 Jan 2001 15:51:52 -0500
- To: "David E. Cleary" <davec@progress.com>
- Cc: "Adalbert Wysocki" <waldi@imediation.com>, <ht@cogsci.ed.ac.uk>, <xmlschema-dev@w3.org>
I think that instead you should restrict integer with a pattern. The problem with minInclusive and maxInclusive, or even enumeration, is that they restrict only the value space, which means that people are still allowed to use <id>03000</id>, <id>+3000</id>, etc. where it seems that the desire here is just to allow the string "3000". If any forms of the value "3000" are allowed, then restriction of integer with a single enumeration would be fine. Morris "David E. Cleary" <davec@progress.com>@w3.org on 01/23/2001 03:12:56 PM Sent by: xmlschema-dev-request@w3.org To: "Adalbert Wysocki" <waldi@imediation.com>, <ht@cogsci.ed.ac.uk> cc: <xmlschema-dev@w3.org> Subject: RE: Simple question on elements constraints Then the fixed attribute isn't what you want. Instead, create a type that is a restriction of integer and has minInclusive and maxInclusive set to 3000. David Cleary Progress Software -----Original Message----- From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]On Behalf Of Adalbert Wysocki Sent: Tuesday, January 23, 2001 2:48 PM To: ht@cogsci.ed.ac.uk Cc: xmlschema-dev@w3.org Subject: RE: Simple question on elements constraints I cannot remove the 'fixed' attribute or must replace it with something else because the value of the element 'id' must be 3000 and in the same time cannot be empty. -----Original Message----- From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk] Sent: Tuesday, January 23, 2001 8:33 PM To: Adalbert Wysocki Cc: xmlschema-dev@w3.org Subject: Re: Simple question on elements constraints Adalbert Wysocki <waldi@imediation.com> writes: > Hi all, > I have a very simple question but it better to ask experienced people rather > than write dirty thinks. > The context is the validation of XML documents using XMLSchema. > How can I specify that an element must have a fixed value and cannot have an > empty one. > > example: > ------- > <?xml version="1.0"?> > <contract> > <id></id> > </contract> > > This document is not valid because the element 'id' is empty whereas it should > be filled with a value and this value equals for example '3000'. > > I tryed following: > ..... > <xsd:element name="id" type="noEmptyElement" fixed="3000"/> > .... > <xsd:simpleType name="noEmptyElement"> > <xsd:restriction base="xsd:string"> > <minLength value="1"/> > </xsd:restriction> > </xsd:simpleType> Just remove the fixed="3000" and you'll have what you want. ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Tuesday, 23 January 2001 15:53:25 UTC