JAXB JXC generates a scheme for enumerations regardless of @XmlTransient

Using the JXC ant schema generation task, I cannot make it ignore the enumeration. I have several enumerations that are used internally to indicate values ​​of type or minor values ​​that are not relevant to the generated XML.

I can exclude the field using enum as @XmlTransient to exclude it from the object's schema, but the simpleType descriptor is still created for enumeration!

Example:

public class CustomerType { @XmlTransient public enum IsolationLevel { ALL, SAME_TYPE, SELECTED } @XmlTransient private Long id; @XmlValue private String name; @XmlTransient private IsolationLevel isolation = IsolationLevel.ALL; } 

Generated circuit:

 <xs:simpleType name="isolationLevel"> <xs:restriction base="xs:string"> <xs:enumeration value="ALL"/> <xs:enumeration value="SAME_TYPE"/> <xs:enumeration value="SELECTED"/> </xs:restriction> </xs:simpleType> 

Anyone have any ideas on how to get JXC to ignore the enumeration? It is not used by any XML-mapped property or field, and the enumeration itself is marked @XmlTransient - why is it still part of my schema?

+4
source share
1 answer

I just ran into this and upgraded my pom to 2.2.11 and at least fixed this version. The Jira comment mentioned in the comments also states that it is fixed in 2.2.5. In doing so, I had to add three dependencies, as shown below:

 <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.12</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.2.11</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.2.11</version> </dependency> 
0
source

All Articles