簡體   English   中英

無法接受自定義JAX

[英]Unable to honor customizations JAX

我查看了此鏈接,但無法導出解決問題的方法: JAXB綁定-“無法接受此轉換自定義”

我有這個XML

<xs:simpleType name="auditory_stimuli">
    <xs:restriction base="xs:boolean"/>
</xs:simpleType>

我用這個定制的:

<xs:simpleType name="auditory_stimuli">
<xs:restriction base="xs:boolean">
    <xs:annotation>
        <xs:appinfo>
            <jaxb:javaType name="java.lang.Boolean"/>
        </xs:appinfo>
    </xs:annotation>
</xs:restriction>

但是,當我運行xjc時,出現此異常

Specified javaType customization is not used.

有人看到我在做什么錯嗎?

<xs:annotation>和綁定定義的其余部分應位於<xs:simpleType>定義內,而不應位於<xs:restriction>

嘗試這個..

<xs:simpleType name="auditory_stimuli">
    <xs:annotation>
        <xs:appinfo>
            <jaxb:javaType name="java.lang.Boolean"/>
        </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:boolean"/>
</xs:simpleType>

對於類似的內容,請參見以下內容。https://docs.oracle.com/javase/tutorial/jaxb/intro/custom.html#bnbch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM