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

Simple question on elements constraints

From: Adalbert Wysocki <waldi@imediation.com>
Date: Tue, 23 Jan 2001 18:59:36 -0000
Message-ID: <9B3E950CB293D411ADF4009027B0A4D27B17BD@PARSV011>
To: xmlschema-dev@w3.org
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.

<?xml version="1.0"?>

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"/>

but the problem is that the value of the element for the post validation is
in the case of an empty element the value specified by the 'fixed' or
'default' attributes. In this case the value is 3000 and its length is
grather than 1 character as specified in the 'noEmptyElement' type
Is there an constraint attribute on the 'element' element specifying that
the content of such an element cannot be empty?


Adalbert Wysocki, software engineer
phone: +33 (0)1 
fax: +33 (0)1
Received on Tuesday, 23 January 2001 13:55:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC