-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Hello!
I try to generate JAXB sources from the XSD schema
My JAXB generated sources contain infamous 'fooOrBarOrBaz' looking property. In my case it is 'actualRemoteSectorIndexOrActualLocalSectorIndexOrRemoteMacAddr' property. In order to get rid of it I try to use 'simplify' plugin.
Unfortunately, I can't make it work. What is get is an error
[ERROR] Error while parsing schema(s).Location [ file:/C:/_code/jaxb2-basics-sample-basic-0.12.0/src/main/resources/test.xjb{9,49}].
com.sun.istack.SAXParseException2: compiler was unable to honor this as-element-property customization. It is attached to a wrong place, or its inconsistent with other bindings.
at com.sun.tools.xjc.ErrorReceiver.error (ErrorReceiver.java:86)
at com.sun.tools.xjc.reader.xmlschema.ErrorReporter.error (ErrorReporter.java:84)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check (UnusedCustomizationChecker.java:150)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.check (UnusedCustomizationChecker.java:128)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.modelGroup (UnusedCustomizationChecker.java:226)
at com.sun.xml.xsom.impl.ModelGroupImpl.visit (ModelGroupImpl.java:110)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.particle (UnusedCustomizationChecker.java:247)
at com.sun.xml.xsom.impl.ParticleImpl.visit (ParticleImpl.java:117)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.modelGroup (UnusedCustomizationChecker.java:228)
at com.sun.xml.xsom.impl.ModelGroupImpl.visit (ModelGroupImpl.java:110)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.particle (UnusedCustomizationChecker.java:247)
at com.sun.xml.xsom.impl.ParticleImpl.visit (ParticleImpl.java:117)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.complexType (UnusedCustomizationChecker.java:188)
at com.sun.xml.xsom.impl.ComplexTypeImpl.visit (ComplexTypeImpl.java:280)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.elementDecl (UnusedCustomizationChecker.java:234)
at com.sun.xml.xsom.impl.ElementDecl.visit (ElementDecl.java:252)
at com.sun.tools.xjc.reader.xmlschema.UnusedCustomizationChecker.particle (UnusedCustomizationChecker.java:247)
at com.sun.xml.xsom.impl.ParticleImpl.visit (ParticleImpl.java:117)
This is my XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:group name="radio-bridge-tg-radio-common___radio-top">
<xs:sequence>
<xs:element minOccurs="0" ref="radio-common"/>
</xs:sequence>
</xs:group>
<xs:element name="radio-common" type="radio-bridge-tg-radio-common___links-top"/>
<xs:complexType name="radio-bridge-tg-radio-common___links-top">
<xs:sequence>
<xs:element minOccurs="0" ref="links"/>
</xs:sequence>
</xs:complexType>
<xs:element name="links">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="active"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="active">
<xs:complexType>
<xs:sequence>
<xs:element ref="remote-assigned-name"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="actual-remote-sector-index"/>
<xs:element ref="actual-local-sector-index"/>
<xs:element ref="remote-mac-addr"/>
<xs:element ref="local-role"/>
<xs:element ref="link-uptime"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="remote-assigned-name" type="radio-bridge-tg-types__node-assigned-name"/>
<xs:element name="actual-remote-sector-index" type="radio-bridge-tg-types__radio-sector-index"/>
<xs:element name="actual-local-sector-index" type="radio-bridge-tg-types__radio-sector-index"/>
<xs:element name="remote-mac-addr" type="ietf-yang-types__mac-address"/>
<xs:element name="local-role" type="radio-bridge-tg-radio-common__link-role"/>
<xs:element name="link-uptime" type="xs:unsignedLong"/>
<xs:simpleType name="radio-bridge-tg-types__node-assigned-name">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z0-9]{1,8}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="radio-bridge-tg-types__radio-sector-index">
<xs:restriction base="xs:unsignedByte">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="4"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ietf-yang-types__mac-address">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="radio-bridge-tg-radio-common__link-role">
<xs:restriction base="xs:token">
<xs:enumeration value="initiator"/>
<xs:enumeration value="responder"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
This is my XJB file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings jaxb:version="2.1"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
jaxb:extensionBindingPrefixes="simplify">
<jaxb:bindings schemaLocation="test.xsd"
node="/xs:schema/xs:element[@name='active']/xs:complexType/xs:sequence/xs:choice">
<simplify:as-element-property />
</jaxb:bindings>
</jaxb:bindings>
This is my pom.xml file:
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
<arg>-Xinheritance</arg>
<arg>-Xcopyable</arg>
<arg>-XenumValue</arg>
<arg>-Xsimplify</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.12.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels