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

JAXB - 屬性“值";已經定義了.使用 <ja

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

問題描述

使用 JAXB 生成 XML 綁定類.

Using JAXB to generate XML binding classes.

架構基于一組舊版 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'屬性沖突,代碼生成失敗,報錯:

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 表達式定位節點并對其進行重命名,從而避免命名沖突.

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()).

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

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

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 久久成人一区 | 日本免费一区二区三区四区 | 一级黄片一级毛片 | 久久久精品国产 | 国产伊人久久久 | 国产精品3区 | 天天爱天天操 | 欧美日韩在线观看一区 | 2020亚洲天堂 | 一区二区三区四区国产 | 久久久www成人免费无遮挡大片 | 美女张开腿露出尿口 | 国产成人精品一区二区 | 成人国产精品色哟哟 | 亚洲一区二区免费视频 | 亚洲午夜电影 | 一区二区三区四区国产精品 | 欧美黄色小视频 | 在线观看亚洲专区 | 精品视频一区二区三区在线观看 | 四虎影院欧美 | 91在线网 | 草久久 | 久久精品日产第一区二区三区 | 日韩精品久久久久 | 亚洲国产精品久久久久秋霞不卡 | 99pao成人国产永久免费视频 | 91偷拍精品一区二区三区 | 日韩av啪啪网站大全免费观看 | 午夜视频一区 | 综合网中文字幕 | 黄色片av| 久久精品成人一区 | 青青草av | 欧美男人天堂 | www97影院| 一区二区三区亚洲视频 | 男人天堂午夜 | 91九色在线观看 | 婷婷精品| 久久国产精品色av免费观看 |