Hi all!
I try to generate classes for schema that contain 2 elements of anonymous complexTypes:
<xsd:element name="elementOfAnonymousComplexType1">
<xsd:complexType>
<xsd:simpleContent>
<xsd:restriction base="xsd:string">
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="elementOfAnonymousComplexType2">
<xsd:complexType>
<xsd:simpleContent>
<xsd:restriction base="xsd:string">
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
When I try to create marshaller from JAXBContext following exception is thrown:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
The element name {http://bercut.com/test/xsd} has more than one mapping.
this problem is related to the following location:
at public javax.xml.bind.JAXBElement com.bercut.test.xsd.ObjectFactory.create(com.bercut.test.xsd.ElementOfAnonymousComplexType1)
at com.bercut.test.xsd.ObjectFactory
this problem is related to the following location:
at public javax.xml.bind.JAXBElement com.bercut.test.xsd.ObjectFactory.create(com.bercut.test.xsd.ElementOfAnonymousComplexType2)
at com.bercut.test.xsd.ObjectFactoryat com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
Is it possible to have several elements of anonymous complexType in single namespace?