jaxb-xew-plugin icon indicating copy to clipboard operation
jaxb-xew-plugin copied to clipboard

ObjectFactory compilation error for collection using complexType

Open Rizen59 opened this issue 2 years ago • 2 comments

Hi,

The following xsd (valid according to Altova XMLSpy software) produced a compilation error on ObjectFactory at the generation. It expects the class Generation.ProductionStockage.AppointCollection.class to be created but nothing exist in Generation.ProductionStockage.

Without xew plugin the generation works fine. Also if there is only one element in appoint_collection.

Plugin used:

  • maven-jaxb2-plugin : 0.15.1
  • jaxb-xew-plugin : 1.11
  • Environment : Java 8 / Maven 3.6.0

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="generation">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="production_stockage_collection">
          <xs:complexType>
            <xs:sequence minOccurs="0">
              <xs:element name="production_stockage" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:all>
                    <xs:element name="appoint_collection" minOccurs="0">
                      <xs:complexType>
                        <xs:sequence minOccurs="0" maxOccurs="unbounded">
                          <xs:element name="joule_effect" type="xs:string" minOccurs="0"/>
                          <xs:element name="combustion" type="xs:string" minOccurs="0"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Rizen59 avatar Jul 06 '22 12:07 Rizen59

Very likely I won't have time to look into that till August...

dmak avatar Jul 08 '22 10:07 dmak

Don't worry I can wait until that. Thanks.

It appears 4 methods are created to create elements for appoint_collection :

  • createGenerationProductionStockageAppointCollectionJouleEffect
  • createGenerationProductionStockageAppointCollectionCombustion
  • createGenerationProductionStockageJouleEffect
  • createGenerationProductionStockageCombustion

I suppose the problem came from the first two methods that should not be present. The generated code in Generation.java seems correct to me.

Rizen59 avatar Jul 11 '22 07:07 Rizen59

Hi dmak, Have you any additional information on that problem?

Rizen59 avatar Jan 09 '23 09:01 Rizen59

The methods that didn't compile in ObjectFactory should have been removed but due to renaming, the information about them was "lost". The issue will be fixed in next release v2.1. Attaching the playground project (XEW-72-scoped.zip).

dmak avatar Jan 20 '23 22:01 dmak