users@jaxb.java.net

JAXB Default Field Value

From: <jej2003_at_gmail.com>
Date: Thu, 28 Apr 2011 01:43:01 +0000 (GMT)

First sorry for the double post if this shows up twice...

I have a schema with an attribute with a fixed value. JAXB generates
the following given the schema:

 @XmlAttribute(name = "version")
   protected String version;
   public String getVersion() {
       if (version == null) {
           return "2.0";
       } else {
           return version;
       }
   }

but since the XmlAccessType on the class is set to XmlAccessType.FIELD
the version value is null. Is there a way when generating the class
through an external binding to instead generate a class that looks
like this:

 @XmlAttribute(name = "version")
   protected String version = "2.0";
   public String getVersion() {
           return version;
   }