We are still in the holiday closure period, as indicated in the
announcement sent
by Ryan. However, I was just checking in..
Gary Gregory wrote:
>
>
> > 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... :-(
The spec does not say that. The spec states (in Section 5.3.2 ) that
derivation by
restriction is handled the same as derivation by extension. So the
generated content
interface IntelMachineProfile extends the content interface
AbstractTargetMachineProfile. Therefore no properties are generated for
attributes such as "name" in the IntelMachineProfile.
There is nothing in the spec that precludes the XML schema from working
as you indicated. As a workaround, you can specify the default value on
the abstractTargetMachineProfile type. If your schema has different
default values for
attributes in different types derived from abstractMachineProfile then
obviously this does not work.
Sekhar
>
>
> > 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