嗨,我有一个这样定义的架构:
<complexType name="x">
<sequence>
<element name="year" type="date"/>
<choice>
<element name="comuneNascita" type="string" nillable="true"/>
<element name="statoNascita" type="string" nillable="true"/>
</choice>
</sequence>
</complexType>
当我尝试编组使用 xjc (使用 xjc:simple 选项)生成的类时,我得到了以下结果:
[...]
<statoNascita xsi:nil="true"/>
<comuneNascita>xxx</comuneNascita>
[...]
这是完全错误的!
删除 nillable="true" 解决了这个问题,但是我必须指定一个有效的元素(不是 nilled )。任何解决方法?