XBinder 2.3 has been released. New features include:

  • Support for Visual Studio 2012
  • 64-bit Windows libraries
  • Java and C# support for nillable elements (C & C++ already supported)

Log in to your account page to download XBinder 2.3, or register for an evaulation!

Java and C# Nillable Elements

The new support for nillable elements is pretty easy to work with.  A nillable element is modeled using XBNillableElem.  XBNillableElem is a wrapper class that contains a value representing an XSD type and a flag that indicates whether that value has been nilled or not. For example, you may have some XSD such as:

<complexType name="MyComplex">
      <xsd:element name="an_element" type="xsd:string"/>
   <xsd:attribute name="an_attribute" type="xsd:string" use="required"/>

   <!-- An element inside some complex type -->
   <xsd:element name="myComplexElem" type="MyComplex" nillable="true"/>

You will then have a field generated such as:

protected XBNillableElem<MyComplex> myComplexElem;

When creating a value for myComplexElem, you may create a nilled or not-nilled element. If you create a nilled element, you will not need to populate "an_element" (it is not present when the element is nilled), but you will need to populate "an_attribute" (it is present when the element is nilled).  Here is an example of populating myComplexElem as being nilled:

MyComplex myComplex = new MyComplex();
myComplex.setAn_attribute("attribute value");
outerobj.setMyComplexElem( new XBNillableElem<MyComplex>
                                    myComplex, true /*nilled*/) );