XmlBeans keeps this sort of information in the .xsb files that it
generates rather than in annotations on the Java. However there is a way
to get to it from the Java.

Suppose you've generated MyElementDocument.class from an element called
myElement in targetNamespace http://myNamespace/test.

Then I think you could do something like the following:

QName myQName = new QName("http://myNamespace/test";, "myElement");
SchemaProperty myProp =       
    MyElementDocument.type.getElementProperty(myQName);
String defaultText = myProp.getDefaultText();

Have a look at the javadoc for SchemaProperty for more detail about the
hasDefault(), getDefaultText() and getDefaultValue() methods.

Cheers,

Lawrence

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 26, 2006 1:40 PM
> To: [email protected]
> Subject: Source Generation - ignored default values in XSD
> 
> Hi,
> 
> If an element in a xml schema is declared with a default value then is
> there a
> way for the xmlBeans source generator to reflect this in the generated
> java
> source. I know that other xml binding frameworks like Castor provides
this
> by
> default.
> 
> Many thanks for your help.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to