I believe this is the same problem as I filed here
http://java.net/jira/browse/JAXB-855
Please vote for this issue
-----Original Message-----
From: Daniel Kan [mailto:dkan_at_silverspringnet.com]
Sent: 12 May 2011 23:22
To: users_at_jaxb.java.net
Subject: inheritance issue: elements (via xs:restriction) in xsd not showing up as fields in subclass in generated java file
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>
* <complexType name="EndDeviceEventsPayloadType">
* <complexContent>
* <restriction
base="{
http://www.iec.ch/TC57/2010/schema/message}PayloadType">
* <sequence>
* <choice>
* <element
ref="{
http://iec.ch/TC57/2009/EndDeviceEvents#}EndDeviceEvents"/>
* <element name="Compressed"
type="{
http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </choice>
* <element name="Format"
type="{
http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </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>
* <complexType name="PayloadType">
* <complexContent>
* <restriction base="{
http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <choice>
* <any namespace='##other' maxOccurs="unbounded"
minOccurs="0"/>
* <element name="Compressed"
type="{
http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </choice>
* <element name="Format"
type="{
http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </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;