equivalent of NOT NULL for element values?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

equivalent of NOT NULL for element values?

Lev Lvovsky-2

Hello, we're using Schema to validate a SOAP feed - I'd like to  
require that certain elements be supplied without "null" (for lack of  
a better word) values:

<some_element></some_element>

Ideally this would be illegal according to the Schema regardless of  
the type of data that the element contained.

If this is not possible, or rather if it's acheived by restrictions  
in simpleType definitions, how can I impose a non-null value for an  
integer type which may be unbounded positive or negative?

thank you,
-lev


Reply | Threaded
Open this post in threaded view
|

Re: equivalent of NOT NULL for element values?

mozer

what about using facet minLength in a restriction ?

On 3/12/07, Lev Lvovsky <[hidden email]> wrote:

>
> Hello, we're using Schema to validate a SOAP feed - I'd like to
> require that certain elements be supplied without "null" (for lack of
> a better word) values:
>
> <some_element></some_element>
>
> Ideally this would be illegal according to the Schema regardless of
> the type of data that the element contained.
>
> If this is not possible, or rather if it's acheived by restrictions
> in simpleType definitions, how can I impose a non-null value for an
> integer type which may be unbounded positive or negative?
>
> thank you,
> -lev
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: equivalent of NOT NULL for element values?

Lev Lvovsky-2


On Mar 13, 2007, at 3:14 PM, mozer wrote:

> what about using facet minLength in a restriction ?

I'd made the mistake of thinking that the validator would give the  
same error when integer fields where empty (which was my main  
concern).  I'd implemented the minLength restriction on strings, but  
had no solutions for integer types - shows you what testing can  
achieve ;).  Is there an all-type encompassing attribute which  
requires that an element have a value (regardless of whether that  
value then validates based on restrictions etc...)?

Thanks!
-lev

Reply | Threaded
Open this post in threaded view
|

Re: equivalent of NOT NULL for element values?

Syd Bauman

> > what about using facet minLength in a restriction ?

Would the pattern facet do the trick for you?

start =
  element some_element {
    xsd:nonNegativeInteger { pattern = "[0-9]+" }
  }
 

> I'd made the mistake of thinking that the validator would give the
> same error when integer fields where empty (which was my main
> concern). I'd implemented the minLength restriction on strings, but
> had no solutions for integer types - shows you what testing can
> achieve ;). Is there an all-type encompassing attribute which
> requires that an element have a value (regardless of whether that
> value then validates based on restrictions etc...)?