users@jaxb.java.net

inheritance issue: elements (via xs:restriction) in xsd not showing up as fields in subclass in generated java file

From: Daniel Kan <dkan_at_silverspringnet.com>
Date: Thu, 12 May 2011 14:22:22 -0700

I'm using xjc maven plugin to generate java classes from xsds, but am
encountering some inheritance problem. I have two complexTypes:
EndDeviceEventsPayloadType and PayloadType. EndDeviceEventsPayloadType
inherits from PayloadType and additionally contains a reference to
EndDeviceEvents via xs:restriction. The problem is that this reference
fails to show up in the generated EndDeviceEventsPayloadType class.
EndDeviceEventsPayloadType simply extends PayloadType as shown below. I
would like to see a field called endDeviceEvents to show up in the
EndDeviceEventsPayloadType class. I haven't yet tried custom bindings.
Thanks in advance for any help.

Dan



/**
 * <p>Java class for EndDeviceEventsPayloadType complex type.
 *
 * <p>The following schema fragment specifies the expected content
contained within this class.
 *
 * <pre>
 * &lt;complexType name="EndDeviceEventsPayloadType">
 * &lt;complexContent>
 * &lt;restriction
base="{http://www.iec.ch/TC57/2010/schema/message}PayloadType">
 * &lt;sequence>
 * &lt;choice>
 * &lt;element
ref="{http://iec.ch/TC57/2009/EndDeviceEvents#}EndDeviceEvents"/>
 * &lt;element name="Compressed"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 * &lt;/choice>
 * &lt;element name="Format"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 * &lt;/sequence>
 * &lt;/restriction>
 * &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EndDeviceEventsPayloadType")
public class EndDeviceEventsPayloadType
    extends PayloadType
{


}


/**
 * Payload container
 *
 * <p>Java class for PayloadType complex type.
 *
 * <p>The following schema fragment specifies the expected content
contained within this class.
 *
 * <pre>
 * &lt;complexType name="PayloadType">
 * &lt;complexContent>
 * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 * &lt;sequence>
 * &lt;choice>
 * &lt;any namespace='##other' maxOccurs="unbounded"
minOccurs="0"/>
 * &lt;element name="Compressed"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 * &lt;/choice>
 * &lt;element name="Format"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 * &lt;/sequence>
 * &lt;/restriction>
 * &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PayloadType", propOrder = {
    "any",
    "compressed",
    "format"
})
@XmlSeeAlso({
    EndDeviceEventsPayloadType.class
})
public class PayloadType {

    @XmlAnyElement(lax = true)
    protected List<Object> any;
    @XmlElement(name = "Compressed")
    protected String compressed;
    @XmlElement(name = "Format")
    protected String format;