Unions

Handling for a union depends on the member types. If the member types all map to the same Java type, then that type will be used. Otherwise, XBinder will use String. If any memberType is a list type, XBinder will use an array of the appropriate type (as just described).

Example XSD:

   <xsd:simpleType name="positiveFloat">
      <xsd:restriction base="xsd:float">
         <xsd:minExclusive value="0"/>
      </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="NegIntPosFloat">
      <xsd:union memberTypes="xsd:negativeInteger positiveFloat"/>
   </xsd:simpleType>

C#:

   public class NegIntPosFloat
   {
      public static readonly int _member1MAX = -1;

      //constructor
      private NegIntPosFloat() {} 

      public static String encode(string value, XBContext xbContext) {...}

      public static string decode(String text, XBContext xbContext) {...}
   }

Java:

   public class NegIntPosFloat
   {
      public static final int _member1MAX = -1;

      //constructor
      private NegIntPosFloat() {} 

      public static String encode(String value, XBContext xbContext) {...}

      public static String decode(String text, XBContext xbContext) {...}
   }

The example defines a type that combines an integer-based type and a float-based type. XBinder would represent each of the memberTypes using a different C#/Java type, so it uses String as the representation.