Re: equivalent of "NOT NULL" in schema?

I'm assuming that your using the NOT NULL in the SQL sense.  This maps to 
schema's nillable feature.  In schema's case NOT NULL is the default.

I think xs:string (as a few variations of that) are the only types that you 
have to worry about having zero length.  Therefore, it sounds like you need 
to define a type of string that has minimum length one.  You may also need 
to define a pattern for it so that strings such as single spaces are not 
allowed.  For example:

    <xs:simpleType name="stringMin1">
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
        </xs:restriction>
    </xs:simpleType>

Or:

    <xs:simpleType name="stringMin1">
        <xs:restriction base="xs:string">
            <xs:pattern value=".*\S.*"/>
        </xs:restriction>
    </xs:simpleType>

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

----- Original Message ----- 
From: "Lev Lvovsky" <lists2@sonous.com>
To: <xmlschema-dev@w3.org>
Sent: Monday, March 12, 2007 7:16 PM
Subject: equivalent of "NOT NULL" in schema?


>
> Hello, I'm new to Schema, so if this question is not appropriate for  this 
> list, please let me know.
>
> We're using SOAP to transfer data from one database to another.  I'm  in 
> the process of working out a Schema definition which allows us to 
> validated the SOAP response as much as possible before attempting  inserts 
> into the database.  I'm curious what the best way to define a  type which 
> implies "NOT NULL", specifically, that an element must  have at least one 
> character present for whatever data type it is.   Clearly this can be done 
> with multiple restrictions on minLength of a  simpleType, but is there any 
> way to "inherit" from a "not null" type  in the Schema to where a string 
> or integer simply uses that "not  null" type  as a base?  The goal being 
> to use the "minLength"  qualifier only once.
>
> Any help would be appreciated!
>
> thanks,
> -lev
>
> 

Received on Tuesday, 13 March 2007 17:00:51 UTC