[英]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.