Title: RE: NullPointerException when reading the leaves of the XML data
Hm, I see what you're saying, but it can't work the way you want, unfortunately, because when you validate or data bind an instance of the union, the type assigned to it must be one of the member types of the union. Suppose we have two enumeration types Enum1 and Enum2 and Union a union between the two. Then, an instance of Union must either be an instance of Enum1 or an instance of Enum2, depending upon the value. Therefore (in Java) the Union class must be a superclass of both Enum1 and Enum2 (to be able to represent values of both types), so it can't be an enumeration itself.
You can enforce usage of the enumeration values by turning XmlOptions.setValidateOnSet on and you can of course use the String constants generated for you in the two enumeration classes. The only thing that you'll lack is compile-time checking.
 
Radu
-----Original Message-----
From: Ole Matzura [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 2:30 AM
To: [email protected]
Subject: problems with union of 2 enumerations.

Hi all!
We have created two enumerations and a third simpleType consisting of a union of these 2, hoping that XMLBeans would create an enum with all enumeration values from both types available in our union type.. unfortunately this union type only gets setStringValue / setObjectValue methods and not any set( Enum ..) method(s).. (we're using 1.0.4)
 
not a big problem really, just wondering if there is any solution or workaround available, it would be nice to enforce usage of enumeration values..
 
regards!
 
/Ole
 

Reply via email to