users@jaxb.java.net

default element value

From: Arek Stryjski <developer_at_krzyzowki.net.pl>
Date: Tue, 06 May 2003 15:18:56 +0200

I have this XML schema fragment:

<xsd:complexType name="AutodebugMeta">
<xsd:sequence>
<xsd:element name="body-type" type="BodyType" default="test" />
<xsd:element name="dealer-id" type="xsd:string"/>
<xsd:element name="user-id" type="xsd:string" default="na"/>
<xsd:element name="res-id" type="xsd:string" default="na"/>
<xsd:element name="time" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>

In genereted class I got:

/**
* Java content class for AutodebugMeta complex type.
* <p>The following schema fragment specifies the expected content contained
within this java content object.
* <p>
* <pre>
* &lt;complexType name="AutodebugMeta">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="body-type" type="{}BodyType"/>
* &lt;element name="dealer-id"
type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="user-id"
type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="res-id"
type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="time"
type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*/

Well I don't agree with sentence: "The following schema fragment specifies
the expected content".

I don't understand why generated code does not take default values? Is
something wrong with my schema, or JAXB does not support this. It will be
very strange if this will be not supported in version 1.0 because as far as
I remember it was working in JAXB-ea for DTD.

Regards
Arek