繁体   English   中英

JAXB为XSD的复杂类型和元素引用两次生成类

[英]JAXB generates class twice for complextype and element ref from XSD

我的场景: complexType和一个别名为此complexType的元素 (它们具有不同的名称)。 他们两个都有注释 文档

这将导致Status.java和StatusType.java具有完全相同的内容。 (只有其中之一带有XmlRootElement)

<xs:element name="Status" type="Status_Type">
    <xs:annotation>
        <xs:documentation xml:lang="en">Some docs.</xs:documentation>
    </xs:annotation>
</xs:element>

<xs:complexType name="Status_Type">
    <xs:annotation>
        <xs:documentation xml:lang="en">Some docs.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
        <!-- some elements -->
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID"/>
</xs:complexType>

但是,当我仅从元素中删除注释文档时,我只会得到一个 生成的 Java ,这实际上是预期的结果! 如何配置此行为? :)我想使XSD保持不变,因为它是由其他供应商提供的,不是由我们公司开发的,但是我不希望类重复。

谢谢!

我们在XSD中找到了两个错别字实例:

<xs:element name="SomeElement" type="Boolean_Type"/>
<xs:annotation>
    <xs:documentation xml:lang="hu">SomeDocs</xs:documentation>
</xs:annotation>
<xs:element name="SomeOtherElement" type="Identifier_Type"/>

因此,notification-doc元素处于同一级别的元素,而不是在元素内部。 修复它们后,JAXB构建成功。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM