W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

RE: Element not containing 'blank' text value

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Fri, 15 Feb 2002 10:33:33 -0800
Message-Id: <8904C60CACA7D51191BC00805FEAAF4358EAEA@crdc-exch-7.crdc.kp.org>
To: "'Stig Henning Berg'" <shb@scope.no>, xmlschema-dev@w3.org
> -----Original Message-----
> From:	Stig Henning Berg [SMTP:shb@scope.no]
> Sent:	Thursday, February 14, 2002 3:00 AM
> To:	xmlschema-dev@w3.org
> Subject:	Element not containing 'blank' text value
> 
> How do I specify in the schema that an Element must have a text value
> which is not blankL or Empty?
> 
If by "blank" you mean "must have some value", then the following will do it
for you:

<xs:element name='foo'>
  <xs:simpleType>
    <xs:restriction base='xs:string'>
      <xs:minLength value='1'/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

If you mean "must contain at least one non-blank (white-space) character",
then try:

<xs:element name='foo'>
  <xs:simpleType>
    <xs:restriction base='xs:string'>
      <xs:pattern value='[.\r\n]*\S+[.\r\n]*'/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>

pvb
Received on Friday, 15 February 2002 13:51:11 GMT

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