users@jaxb.java.net

[feature request] Using defaults from code in a XSD default.

From: Gary Gregory <ggregory_at_seagullsw.com>
Date: Thu, 26 Jun 2003 17:28:04 -0400

Hello,

Some of our code uses a third party library (Apache Jakarta Commons
HttpClient if you must know) and we configure one of our component which
uses it with an XML file for which we have an XSD which we generate code
with JAXB. So far so good and we like it.

Right now, the XSD must be kept in sync with various default values in the
library. For example, the lib has a setting called "maxConnectionsPerHost"
with a default value of 2. So, in our XSD we have:

<xs:attribute name="maxConnectionsPerHost" type="cics:positiveShort"
use="optional" default="2">

and

    <xs:simpleType name="positiveShort">
        <xs:restriction base="xs:unsignedShort">
            <xs:minInclusive value="1"/>
        </xs:restriction>
    </xs:simpleType>

It would be nice if somehow, I could tell JAXB to pick up the default value
from "com.foo.ThatClass.THE_CONSTANT", which would minimize maintenance on
keeping the XSD in sync with the code.

Thanks,
Gary