Xsd XJC和<;xs:choice>;

Xsd XJC和<;xs:choice>;,xsd,jaxb,xjc,choice,Xsd,Jaxb,Xjc,Choice,我在处理xjc及其处理问题的方式时遇到问题 我会解释: <xs:element name="catalog"> <xs:complexType> <xs:choice minOccurs="1" maxOccurs="unbounded"> <xs:element name="element1" type="subType1" /> <xs:element name="e

我在处理xjc及其处理问题的方式时遇到问题

我会解释:

<xs:element name="catalog">
    <xs:complexType>
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="element1" type="subType1" />
            <xs:element name="element2" type="subType2" />
            ...
        </xs:choice>
    </xs:complexType>
</xs:element>

<xs:complexType name="type">
    <xs:attribute name="dummy"/>
</xs:complexType>

<xs:complexType name="subType1">
    <xs:complexContent>
        <xs:extension base="type">
            ....
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

...
....
在这段代码上运行xjc没有问题。但是,生成的Catalog java类具有标准的getSubject1orSubtype2方法,该方法返回一个列表

有没有办法让它产生

  • 此方法无效,但名称不同
  • 其他特定于类型的方法(GetSubject1和GetSubject2)

  • 你找到那个问题的答案了吗?