XSD generator fails to create @XmlRootElement
---------------------------------------------
Key: CXF-2423
URL: https://issues.apache.org/jira/browse/CXF-2423
Project: CXF
Issue Type: Bug
Components: Tooling
Affects Versions: 2.2.3
Environment: Windows XP, Maven 2.0.9, Maven plugin:
org.apache.cxf:cxf-common-xsd version 2.2.3
Reporter: Ruud de Jong
The xsdtojava-goal fails to create a proper Java class with @XmlRootElement in
some situations. As a result, the generated code cannot be converted from
Object to XML (JAXB), because their is no @XmlRootElement defined.
The following XSD works and creates the Java class with an @XmlRootElement:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="example"
targetNamespace="example">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string" />
<xs:element name="from" type="xs:string" />
<xs:element name="heading" type="xs:string" />
<xs:element name="body" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
But changing this slightly to an XSD which should be similar:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="example"
targetNamespace="example">
<xs:element name="note" type="NoteType" />
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="to" type="xs:string" />
<xs:element name="from" type="xs:string" />
<xs:element name="heading" type="xs:string" />
<xs:element name="body" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
In this second XSD, CXF fails to create a Java class named "Note" with
@XmlRootElement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.