相关疑难解决方法(0)

JAXB绑定自定义

在尝试从xsd生成类时,我遇到了这个错误:

java.lang.IllegalArgumentException: Illegal class inheritance loop.  Outer class OrderPropertyList may not subclass from inner class: OrderPropertyList
Run Code Online (Sandbox Code Playgroud)

我的xsd定义了一个元素来组合一个无界元素,如下所示:

  <element minOccurs="0" name="orderPropertyList">
    <complexType>
      <sequence>
        <element maxOccurs="unbounded" name="orderProperty" type="tns:orderProperty" />
      </sequence>
    </complexType>
  </element>
Run Code Online (Sandbox Code Playgroud)

我的自定义绑定遵循此页面上的指定,但它不起作用.在这里我绑定:

<jaxb:bindings schemaLocation="../xsd/Schema.xsd" node="/xs:schema">
    <jaxb:bindings node="//xs:element[@name='orderPropertyList']">
        <jaxb:class name="OrderPropertyList"/>
    </jaxb:bindings>
</jaxb:bindings>
Run Code Online (Sandbox Code Playgroud)

我的目的是为orderPropertyList生成一个单独的类,而不是在xsd的根元素内生成内部类的默认行为.

我在这里这里看到了有同样意图的人,但它对我来说不起作用.:(

JAXB版本:

Specification-Version: 2.1
Implementation-Version: 2.1.8
Run Code Online (Sandbox Code Playgroud)

有帮助吗?

xml xsd jaxb

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

jaxb ×1

xml ×1

xsd ×1