久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

JAXB - 屬性“值";已經(jīng)定義了.使用 <ja

JAXB - Property quot;Valuequot; is already defined. Use lt;jaxb:propertygt; to resolve this conflict(JAXB - 屬性“值;已經(jīng)定義了.使用 lt;jaxb:propertygt;解決這個(gè)沖突)
本文介紹了JAXB - 屬性“值";已經(jīng)定義了.使用 <jaxb:property>解決這個(gè)沖突的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

使用 JAXB 生成 XML 綁定類.

Using JAXB to generate XML binding classes.

架構(gòu)基于一組舊版 XML 文件,并包含以下代碼段:

The schema is based on a set of legacy XML files, and includes this snippet:

<xs:complexType name="MetaType">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute type="xs:string" name="Name" />
            <xs:attribute type="xs:string" name="Scheme" />
            <xs:attribute type="xs:string" name="Value" />
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

'Value'屬性與xs:string的'value'屬性沖突,代碼生成失敗,報(bào)錯(cuò):

The 'Value' attribute conflicts with the 'value' property of xs:string, and the code generation fails with the error:

com.sun.istack.SAXParseException2: Property "Value" is already defined. Use &lt;jaxb:property> to resolve this conflict. 

推薦答案

答案在于利用 JAXB 綁定(site-template.xjb):

The answer lies in making use of JAXB bindings (site-template.xjb):

<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
          xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
          xmlns:xs="http://www.w3.org/2001/XMLSchema"
          version="2.1">
    <bindings schemaLocation="site-template.xsd" version="1.0">
        <!-- Customise the package name -->
        <schemaBindings>
            <package name="com.example.schema"/>
        </schemaBindings>

        <!-- rename the value element -->
        <bindings node="http://xs:complexType[@name='MetaType']">
            <bindings node=".//xs:attribute[@name='Value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
    </bindings>
</bindings>

XPath 表達(dá)式定位節(jié)點(diǎn)并對(duì)其進(jìn)行重命名,從而避免命名沖突.

The XPath expressions locate the nodes and renames it, thereby avoiding the naming conflict.

使用此綁定 XML 文件,生成的 Java 類最終具有所需的 getValueAttribute()(以及 getValue()).

Using this bindings XML file, the generated Java class ends up having the desired getValueAttribute() (as well as the getValue()).

這篇關(guān)于JAXB - 屬性“值";已經(jīng)定義了.使用 &lt;jaxb:property&gt;解決這個(gè)沖突的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動(dòng)生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫(kù))
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對(duì)象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 久久这里只有精品首页 | 免费黄色的视频 | 欧美精品在线观看 | 国产电影一区二区在线观看 | 成人黄色a | 国产在线不卡 | 免费黄色在线 | 欧美日韩综合一区 | 日本不卡一区 | 欧美精品久久久久久久久久 | 狠狠的干 | 亚洲一区二区三区四区在线观看 | 91国产在线视频在线 | 色久五月 | 成人毛片在线观看 | 国产成人免费视频网站视频社区 | 日韩在线欧美 | 国产精品99久久久久久人 | 精品国产伦一区二区三区观看体验 | 国产日韩91 | 国产高清无av久久 | 欧美色影院 | 免费播放一级片 | 毛片免费在线 | 久久久久久九九九九 | 久久久久一区二区 | 精品在线免费观看视频 | 精品国产综合 | 日韩欧美在线观看视频 | 国产96色在线 | 精品国产一区二区三区久久狼黑人 | 一级黄色毛片 | 99久久久无码国产精品 | 亚洲男人天堂 | 亚洲午夜久久久 | 亚洲性视频| 黄色网页在线观看 | 久久亚洲视频 | 免费看av大片 | 久久九九影视 | 欧美在线激情 |