JAXB自定义绑定-跳过模式中生成的类

JAXB自定义绑定-跳过模式中生成的类,jaxb,Jaxb,我有以下模式: <xs:element name="Invoice"> <xs:complexType> <xs:sequence> ..... <xs:element name="InvoiceLines" type="InvoiceLinesType"> </xs:element> ..... </xs:complexType>

我有以下模式:

<xs:element name="Invoice">
    <xs:complexType>
      <xs:sequence>
        .....
        <xs:element name="InvoiceLines" type="InvoiceLinesType">
        </xs:element>
        .....
    </xs:complexType>
</xs:element>

<xs:complexType name="InvoiceLinesType">
   <xs:sequence>
     <xs:element maxOccurs="unbounded" name="InvoiceLine" type="InvoiceLineType">
     </xs:element>
   </xs:sequence>
</xs:complexType>

<xs:complexType name="InvoiceLineType">    
 <xs:sequence>
   .....
 </xs:sequence>
</xs:complexType>

.....
.....
.....
问题是,它会生成类:

  • 发票-包含InvoiceLinesType的成员
  • InvoiceLinesType-包含InvoiceLineType的集合
  • 发票线型
因此有一个不必要的类(InvoiceLinesType),我更喜欢下面的

  • 发票-包含InvoiceLineType的集合
  • 发票线型
是否有人知道如何告诉编译器不要生成此包(InvoiceLinesType)

我当前的外部绑定文件在那里

<jxb:bindings schemaLocation="invoice.xsd" node="/xs:schema"> 
    <jxb:globalBindings>
        .....            
        <xjc:simple/>
        .....
    </jxb:globalBindings>
</jxb:bindings> 

.....            
.....

感谢您的回复。

您必须修改您的架构-删除InvoiceLinesType并将InvoiceLineType作为Invoice中的无界元素

<xs:element name="Invoice">
    <xs:complexType>
      <xs:sequence>
        .....
        <xs:element maxOccurs="unbounded" name="InvoiceLine" type="InvoiceLineType">
        </xs:element>
        .....
    </xs:complexType>
</xs:element>

<xs:complexType name="InvoiceLineType">    
 <xs:sequence>
   .....
 </xs:sequence>
</xs:complexType>

.....
.....
.....

给出了该方案。我无权更改它。它是在web服务中使用的,那么XJC就没什么用处了。为什么那节额外的课让你这么烦恼?