You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jose María Zaragoza <de...@gmail.com> on 2013/11/26 09:05:00 UTC

wsdl2java + choice (one or both )

Hello:


I'm using Apache CXF 2.7.3

I've having problems to generate JAXB classes from XSD that cointains
this element

<xs:choice>
    <xs:sequence>
       <xs:element name="X" type="xs:string"/>
      <xs:element name="Y" type="xs:string" minOccurs="0"/>
       </xs:sequence>
<xs:element name="Y" type="xs:string"/>
</xs:choice>

The problem is because there is two element called "Y" and I guess the
tools doesn't know how to generate the JAXB class, but I think that it
should generate two String fields no required

Any idea ? Any w/a ?


Thanks

Re: wsdl2java + choice (one or both )

Posted by Aki Yoshida <el...@gmail.com>.
One problem is that you have technically two different "Y"s for that
class, so the generator can't simply use the same attribute for both
"Y"s.

I don't know if you can use jaxb custom binding to rename the second
"Y" in your case in conjunction with the choice model. And this is
another problem. If the generator ignores the specified constraint and
simply generates X and Y as optional attributes or you use some
binding customization to generate such a class, that class will accept
an instance having neither X nor Y, which violates the original
constraint.

regards, aki


2013/11/26 Jose María Zaragoza <de...@gmail.com>:
> Hello:
>
>
> I'm using Apache CXF 2.7.3
>
> I've having problems to generate JAXB classes from XSD that cointains
> this element
>
> <xs:choice>
>     <xs:sequence>
>        <xs:element name="X" type="xs:string"/>
>       <xs:element name="Y" type="xs:string" minOccurs="0"/>
>        </xs:sequence>
> <xs:element name="Y" type="xs:string"/>
> </xs:choice>
>
> The problem is because there is two element called "Y" and I guess the
> tools doesn't know how to generate the JAXB class, but I think that it
> should generate two String fields no required
>
> Any idea ? Any w/a ?
>
>
> Thanks