O'Reilly logo

Real World XML Web Services: For VB and VB .NET Developers by Yasser Shohoud

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.8. Nil Values

XSD lets you indicate explicitly that an element is nil (Nothing in VB) as opposed to empty (that is, no content). For example, if you were out of chocolate cake and the DessertMenu object had only two items, you'd expect Item3 to be Nothing. To express this in the schema and instance document, you perform two steps. First, modify the schema so that the item elements are nillable:

<!-- the DessertMenu --> 
<element name="DessertMenu">
  <complexType>
    <sequence>
      <element name="Item1" type="dx:Dessert" nillable="true" />
      <element name="Item2" type="dx:Dessert" nillable="true"/>
      <element name="Item3" type="dx:Dessert" nillable="true"/>
    </sequence>
  </complexType>
</element>

then modify the XML instance document by adding xsi:nil=

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required