LibraryLink ToToggle FramesPrintFeedback

Unions

In XML Schema, a union is a construct that allows you to describe a type whose data can be one of a number of simple types. For example, you can define a type whose value is either the integer 1 or the string first. Unions are mapped to Java Strings.

XML Schema unions are defined using a simpleType element. They contain at least one union element that defines the member types of the union. The member types of the union are the valid types of data that can be stored in an instance of the union. They are defined using the union element's memberTypes attribute. The value of the memberTypes attribute contains a list of one or more defined simple type names. Example 12.13 shows the definition of a union that can store either an integer or a string.


In addition to specifying named types as a member type of a union, you can also define an anonymous simple type as a member type of a union. This is done by adding the anonymous type definition inside of the union element. Example 12.14 shows an example of a union containing an anonymous member type that restricts the possible values of a valid integer to the range 1 through 10.


XML Schema union types are mapped to Java String objects. By default, FUSE Services Framework does not validate the contents of the generated object. To have FUSE Services Framework validate the contents you will must configure the runtime to use schema validation as described in Enforcing facets.