|
You are very close. Keep in mind that defaults are not
associated with types, but with elements/attributes. Other than that, once you
use it in the context of an enclosing element, it should work like you
expect.
If you're still having trouble, could you post a code
sample and we'll go from there?
Radu From: Paul Grillo [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 13, 2006 3:04 PM To: [email protected] Subject: Default value support in java classes supported? I'm adding a field
to a previous schema and am adding an element to an existing ComplexType at then
end. What i would like is that any code that begins using the generated
classes will automatically generate the this ComplexType with the added simple
element defaulting to a certain value. That is, i don't want all previous
users to have to go and change their code when i know what the default should
be.
I figured i'd add
the element in the following way. I assumed that the default="E" would, in
some way, get me what i want. Well, if i instantiate the object and read
the type, it is, of course null.
So, is there any way
i can accomplish this? Is there any way that i can add an element to a
complex type and have the xmlbeans generated classes handle a default value for
it?
thanks for any
help.
<xs:element name="Type" default="E" minOccurs="1"
maxOccurs="1">
<xs:annotation> <xs:documentation>Error Type, must be (E)rror, (I)nformational, (W)arning</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="I"/> <xs:enumeration value="E"/> <xs:enumeration value="W"/> </xs:restriction> </xs:simpleType> </xs:element> _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. |
- Default value support in java classes supported? Paul Grillo
- RE: Default value support in java classes suppor... Radu Preotiuc-Pietro

