【问题标题】:What is the meaning of <jxb:bindings version=?<jxb:bindings version= 是什么意思?
【发布时间】:2010-12-29 08:44:24
【问题描述】:

jxb:bindings 中版本属性的允许值是多少?

<jxb:bindings version="2.0"
              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema">

我尝试对 xjc "2.2.3-hudson-jaxb-ri-2.2-70-" 使用不同的值

<jxb:bindings version="2.2"   ... xjc outputs ERROR, only "1.0" is allowed
<jxb:bindings version="2.1"   ... xjc compiled successfully
<jxb:bindings version="2.0"   ... xjc compiled successfully
<jxb:bindings version="1.0"   ... xjc compiled successfully

【问题讨论】:

    标签: jaxb xjc


    【解决方案1】:

    版本属性用于在 JAXB 规范版本之间的绑定发生变化的情况下使用。在使用较新的 JAXB 实现时,这是确保向后兼容性所必需的。有关详细信息,请参阅 JAXB 2.1 规范的第 7.1.4 节。

    指定版本 2.2 时收到的错误消息我认为是 XJC 错误:

    <jxb:bindings version="2.2"   ... xjc outputs ERROR, only "1.0" is allowed
    

    【讨论】:

    • 谢谢,规范jcp.org/aboutJava/communityprocess/mrel/jsr222/index2.html 只允许使用“1.0”和“2.0”:为了表示规范的这个版本,版本应该是“2.0”。 @version 为“1.0”也是有效的。如果指定了任何其他版本,则它必须导致第 7.1.5 节“无效自定义”中指定的无效自定义。只允许“1.0”的错误消息似乎不正确。
    猜你喜欢
    • 2012-12-09
    • 2015-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-12
    • 2017-06-11
    • 2018-03-05
    相关资源
    最近更新 更多