久久久久久久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(使用線程逐塊處理文件)
主站蜘蛛池模板: 亚洲一区电影 | 91亚洲欧美 | 天堂av影院| 玖草资源| 亚洲精品v日韩精品 | 国产精品91网站 | 欧美a级成人淫片免费看 | 一级片aaa| 99热精品国产 | 国产精品国产a | 一区二区三区精品在线视频 | 日韩高清一区二区 | 久久久久一区二区三区 | 国产视频中文字幕在线观看 | 日韩欧美中文字幕在线视频 | 欧美一区二区三区在线观看视频 | 国产一区二区三区高清 | 欧美一区二区三区的 | 欧美日韩一区二区三区不卡视频 | 国产色| 亚洲 欧美 激情 另类 校园 | 久久91精品国产一区二区 | 日本三级日产三级国产三级 | 中文av在线播放 | 日本韩国电影免费观看 | 91精品国产一二三 | 九九热视频这里只有精品 | 午夜视频在线观看网址 | 久久国产成人午夜av影院武则天 | 欧美一级久久精品 | 欧美一区二区在线播放 | 国产高清视频一区 | 国产精品一区二区av | 激情网站 | 本地毛片 | 国产精品一区三区 | 欧美a在线 | 国产日韩一区二区三免费高清 | 日韩欧美国产一区二区三区 | 日韩精品一区二区三区中文字幕 | 久久久久久久久综合 |