1or the string
first. Unions are mapped to Java
Defining in XML Schema
simpleTypeelement. They contain at least one
unionelement 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
memberTypesattribute. The value of the
memberTypesattribute contains a list of one or more defined simple type names. Example 34.13, “Simple Union Type” shows the definition of a union that can store either an integer or a string.
Example 34.13. Simple Union Type
<simpleType name="orderNumUnion"> <union memberTypes="xsd:string xsd:int" /> </simpleType>
unionelement. Example 34.14, “Union with an Anonymous Member Type” 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.
Example 34.14. Union with an Anonymous Member Type
<simpleType name="restrictedOrderNumUnion"> <union memberTypes="xsd:string"> <simpleType> <restriction base="xsd:int"> <minInclusive value="1" /> <maxInclusive value="10" /> </restriction> </simpleType> </union> </simpleType>
Mapping to Java
Stringobjects. By default, Apache CXF does not validate the contents of the generated object. To have Apache CXF validate the contents you will must configure the runtime to use schema validation as described in the section called “Enforcing facets”.