users@jaxb.java.net

Re: Default attribute values on derived complex type (JAXB v.1.0. 1)

From: Gary Gregory <ggregory_at_seagullsw.com>
Date: Tue, 01 Jul 2003 10:07:01 -0400

> JAXB does not implement the inheritance of attributes when restricting a
type, although it should.

Does it say that in the specs? I did not find it. It sure says that
substitution groups are not supported... :-(

> I guess for know you will have to redefine the attributes (+ default
values) on the restricted types.

I thought I did that:

    <xs:complexType name="intelMachineProfile">
        <xs:complexContent>
            <xs:restriction base="cics:abstractTargetMachineProfile">
                <xs:attribute name="name" type="xs:string" use="optional"
default="Intel"/>
                <xs:attribute name="endian" type="cics:endian"
use="optional" default="little"/>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

Are you saying: do not use XSD-style "inheritance", do not define the
attributes in the supertype?

Gary

-----Original Message-----
From: Thomas Plümpe [mailto:thomanski_at_gmx.de]
Sent: Tuesday, July 01, 2003 01:14
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Default attribute values on derived complex type (JAXB v.1.0.1)

Hi Gary,

> I'd like the JAXB object to give me "Intel" and "little" for the
> attributes, it gives me nulls. I am stuck.
I've had a similar problem, the reason for which was that JAXB does not
implement the inheritance of attributes when restricting a type,
although it should.

I guess for know you will have to redefine the attributes (+ default
values) on the restricted types.

Thomas