The Source for Java Technology Collaboration

Home » java.net Forums » GlassFish » Metro and JAXB

Thread: XJC complex type derived by restriction from another complex type derived b

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Last Post: Jul 17, 2008 6:47 AM by: mshaffer55
cboloaja

Posts: 9
XJC complex type derived by restriction from another complex type derived b
Posted: Jul 9, 2008 1:08 PM
 
  Click to reply to this thread Reply

Hi ,

I am trying to use wsimport for a wsdl containing these types :
<xs:complexType name="Complex_TypeE">
<xs:complexContent>
<xs:extension base="Complex_TypeR">
<xs:sequence>
......
</xs:sequence>
<xs:attribute name="Version"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Complex_TypeR">
<xs:complexContent>
<xs:restriction base="Complex_Type">
<xs:sequence>
<xs:sequence>
.....
</xs:sequence>
<xs:sequence minOccurs="0">
....

</xs:sequence>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>

The message I am getting is :

[ERROR] Base complex type "Complex_TypeR" is derived by restriction, while this complex type "Complex_TypeE" is derived by extension. This is not currently handled by XJC, but we are seeking input on this issue. Please report this to the JAXB team.

Does anyone know what the issue might be ?

Thanks,

Catalin

mshaffer55

Posts: 396
Re: XJC complex type derived by restriction from another complex type deriv
Posted: Jul 14, 2008 2:12 PM   in response to: cboloaja
 
  Click to reply to this thread Reply

The issue is that, unlike for extension, Java has no obvious analog for restriction. The JAXB 2.1 spec indicates that restriction should be treated exactly the same as extension, i.e. a subclass should be created, but "...there is no requirement that Java properties representing the attributes or elements removed by the restriction to be disabled.". So a restriction of this kind would be pretty much useless, since the resulting subclass would be identical to the base class. Anyway, based on my reading of the spec, which is reasonably clear on this point, I'm surprised by this error. You could try submitting a defect that points to this thread, and see what happens.

mshaffer55

Posts: 396
Re: XJC complex type derived by restriction from another complex type deriv
Posted: Jul 17, 2008 6:47 AM   in response to: mshaffer55
 
  Click to reply to this thread Reply

The JAXB RI has a vendor customization you might want to check out:

<xjc:treatRestrictionLikeNewType> - Alternative derivation-by-restriction binding mode




 XML java.net RSS