- The UML Class must have the additional stereotype XSDunion.
- “memberTypes” and inner simpleTypes maps to several UML Generalizations between the simple type and members types.
- In order to have an inner simpleType element, the parent of this Generalization must be an inner Class of an outer UML Class.
Union model example.
Union model and XML code samples
<xs:schema xmlns:nm = "http://nomagic.com" xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://nomagic.com" >
<xs:simpleType name = "my_simple_union" >
<xs:union id = "unionID" memberTypes = "xs:string xs:number" />
</xs:simpleType>
<xs:simpleType name = "my_simple_union2" >
<xs:annotation >
<xs:documentation >very important documentation</xs:documentation>
</xs:annotation>
<xs:union id = "unionID" memberTypes = "xs:number" >
<xs:simpleType >
<xs:restriction base = "xs:number" />
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:schema>