users@jaxb.java.net

Re: Problems generating objects from complexContent

From: Martin Grebac <martin.grebac_at_oracle.com>
Date: Thu, 11 Aug 2011 18:23:05 +0200

Hi,
 your usecase is not complete, so hard to tell what's happening. Do you
use any specific customizations while generating the code? Is ArtistRole
defined in the PartyDescriptor? Is any of those using a mixed content
mode which would imply different code generation path?
 MartiNG

On 08/10/2011 11:35 PM, Bastien Jansen wrote:
> Hi,
>
> I'm trying to generate Java objects from the DDEX XSD
> (http://ddex.net/xml/20081015/ddexC.xsd) using JAXB. The problem is
> that the generated objects are missing java attributes.
> For example, this element definition:
>
> <xs:complexType name="DisplayArtist">
> <xs:complexContent>
> <xs:extension base="ddexC:PartyDescriptor">
> <xs:sequence>
> <xs:element name="ArtistRole"
> type="ddexC:ArtistRole" minOccurs="0"
> maxOccurs="unbounded">
> </xs:element>
> </xs:sequence>
> <xs:attribute name="SequenceNumber" type="xs:integer"
> use="optional">
> </xs:attribute>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> is translated into
>
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "DisplayArtist")
> public class DisplayArtist
> extends PartyDescriptor
> {
>
> @XmlAttribute(name = "SequenceNumber")
> protected BigInteger sequenceNumber;
>
> public BigInteger getSequenceNumber() {
> return sequenceNumber;
> }
>
> public void setSequenceNumber(BigInteger value) {
> this.sequenceNumber = value;
> }
>
> }
>
> DisplayArtist.java is missing a List<ArtistRole>. I don't know why it
> is not generated. I noticed that if if remove the complexContent and
> extension tags, I get what I want (but I loose the inheritance...).
>
> Does anyone know why this happens?

-- 
Martin Grebac, GlassFish/Metro/JAXB/Tooling at Oracle
http://blogs.sun.com/mgrebac
ICQ: 93478885