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

RE: Simple question on elements constraints

From: David E. Cleary <davec@progress.com>
Date: Tue, 23 Jan 2001 15:12:56 -0500
To: "Adalbert Wysocki" <waldi@imediation.com>, <ht@cogsci.ed.ac.uk>
Cc: <xmlschema-dev@w3.org>
Message-ID: <NDBBIOBPAGDGFJAHFCGGAEADCFAA.davec@progress.com>
RE: Simple question on elements constraintsThen 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:16:30 GMT

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