RE: Element not containing 'blank' text value

> -----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 UTC