Configuring JAXB binding

When trying to create classes from xsd, I got this error:

java.lang.IllegalArgumentException: Illegal class inheritance loop.  Outer class OrderPropertyList may not subclass from inner class: OrderPropertyList

My xsd defines an element to group an unlimited element as follows:

  <element minOccurs="0" name="orderPropertyList">
    <complexType>
      <sequence>
        <element maxOccurs="unbounded" name="orderProperty" type="tns:orderProperty" />
      </sequence>
    </complexType>
  </element>

And my binding binding follows as indicated on this page , but this does not work. Here is my binding:

<jaxb:bindings schemaLocation="../xsd/Schema.xsd" node="/xs:schema">
    <jaxb:bindings node="//xs:element[@name='orderPropertyList']">
        <jaxb:class name="OrderPropertyList"/>
    </jaxb:bindings>
</jaxb:bindings>

My intention is to create a separate class for orderPropertyList, not the default, which creates an inner class inside the xsd root element.

I watched someone with the same intent here and here , but it does not work properly for me. :(

JAXB Version:

Specification-Version: 2.1
Implementation-Version: 2.1.8

Any help?

+4
source share
5 answers

, :

<jaxb:globalBindings localScoping="toplevel"/>

.

<jaxb:bindings schemaLocation="../xsd/Schema.xsd" node="/xs:schema">
    <jaxb:bindings node="//xs:element[@name='orderPropertyList']">
            <jaxb:class name="OrderPropertyList"/>
    </jaxb:bindings>
</jaxb:bindings>

, orderPropertyList OrderPropertyList. , , .

, , , XPath :

<jaxb:bindings node="//xs:element[@name='orderPropertyList']/xs:complexType">

complexType . , , .

+12

, , :

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
    <xsd:element name="TopLevelElement">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="Something">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="Something" maxOccurs="unbounded">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="somethingFieldA" type="xsd:string"/>
                                        <xsd:element name="somethingFieldB" type="xsd:string"/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

xjc Something, Something complexType s. , , , , ( , Something).

+2

, , , , Java-, "orderProperty", "OrderPropertyList".

, - , . , , .

0

, jeff303. , WSDL.

, philvarner, , node "/xs: complexType", , IllegalArgumentException .

These posts are related, so I decided that the link would be useful for someone to "googling" that ends here.

Ask a question 7881883

0
source

Entering this /xs:complexTypeat the end of the element helped in fixing the error of the inheritance cycle of the illegal class.

0
source

All Articles