gpt4 book ai didi

java - Jaxb 简化插件

转载 作者:行者123 更新时间:2023-12-01 04:58:20 25 4
gpt4 key购买 nike

我尝试使用simplify plugin以简化生成的代码。我有一个定义的类型:

<xsd:complexType name="typeWithReferencesProperty">
<xsd:choice maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo>
<simplify:as-element-property/>
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="a" type="AttributeValueIntegerType"/>
<xsd:element name="b" type="AttributeValueIntegerType"/>
</xsd:choice>
</xsd:complexType>

但它不起作用,因为它会导致以下错误:

compiler was unable to honor this as-element-property customization. It is attached to a wrong place, or its inconsistent with other bindings.

我完全使用了配置,我还有其他可以工作的 jaxb 插件,所以我不太确定,如果插件坏了还是什么?有人设法让它运行吗?

最佳答案

注释应该位于元素标签下,以便让编译器理解它是针对该特定元素的。

尝试以下方法并告诉我是否有效。

<xs:complexType name="typeWithReferencesProperty">
<xs:choice maxOccurs="unbounded">
<xs:element name="a" type="someType">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="b" type="someType">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
</xs:choice>
</xs:complexType>

关于java - Jaxb 简化插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13742199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com