- From: Adalbert Wysocki <waldi@imediation.com>
- Date: Tue, 23 Jan 2001 19:47:39 -0000
- To: ht@cogsci.ed.ac.uk
- Cc: xmlschema-dev@w3.org
- Message-ID: <9B3E950CB293D411ADF4009027B0A4D27B17CD@PARSV011>
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 14:43:34 UTC