OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML Schemas: Is it possible require an element contain*non-whitespac

[ Lists Home | Date Index | Thread Index ]
  • From: Rick JELLIFFE <ricko@geotempo.com>
  • To: ",XML-Dev Mailing list" <xml-dev@xml.org>
  • Date: Tue, 10 Oct 2000 19:42:11 +0800

Dylan Walsh wrote:
> 
> I'm looking into the use of schemas to validate form data submitted by
> website users. Basically, when a user submits a form, such a system would
> build an XML document from the data and then validate it using XML Schemas.
> 
> A common requirement with online forms is that the user has filled in
> *something* into certain fields, i.e. they are mandatory. Is it possible,
> with XML Schemas, to specify that an element *must* contain some text, and
> that text must have atleast some non-whitespace characters in it?

If the element has "complex content" (i.e. it is not derived fom a
simple type) then there is no way to constrain that it must have
characters in it using XML Schemas (unless you declare it belongs to
some notation, or unless you add appinfo constraints, such as an
embedded Schematron schema,
but both of these require external processing.)

If the element is a simple type (including a list of tokens or a union)
then requiring content is built-in as part of the spec for each type:
e.g. "" is not a legitimate integer.   Some simple types allow regular
expressions in a pattern facet: in particular for string-derived types. 
You can use these to specify that strings must contain certain
characters.

The upcoming CR draft will be a little clearer on whitespace than the
current Pre-CR draft.

Cheers,

Rick Jelliffe




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS