Validate elements that can be empty with XSD

Say you have an element looking like this:


    Catcher in the rye

and that element is allowed to also be empty. Like this:


    <book/>

How do you validate it? One way is to use the attribute “nillable” like this


  
    
      <xs:element name="book" type="xs:string" nillable="true"/>
        
      
 

This will validate both a “book” element that is empty and one that is not

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.