equivalent of NOT NULL for element values?

View: New views
4 Messages — Rating Filter:   Alert me  

equivalent of NOT NULL for element values?

by Lev Lvovsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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



Re: equivalent of NOT NULL for element values?

by mozer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


what about using facet minLength in a restriction ?

On 3/12/07, Lev Lvovsky <lists2@...> 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
>
>
>


Re: equivalent of NOT NULL for element values?

by Lev Lvovsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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


Re: equivalent of NOT NULL for element values?

by Syd Bauman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> > 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...)?