When I generate code from the following schema, two classes are created, A
and B
. But, these two classes are not annotated by @XmlRootElement
, so I get an error when I try to marshal an instance of B.
I've looked on the web, I tried the solution using custom bindings (<xjc: simple/>
) but it doesn't work. It seems that an element of type B must be defined in the schema in order for this solution to work.
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:ns="com:mycomp:service" xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="com:mycomp:service"
elementFormDefault="qualified" xml:lang="EN">
<complexType name="A" abstract="true">
<sequence>
<element name="a1" type="string" />
<element name="a2" type="string" />
</sequence>
</complexType>
<complexType name="B">
<complexContent>
<extension base="ns:A">
<sequence>
<element name="b1" type="string" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
Thanks