You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2009/10/15 19:14:31 UTC

[jira] Resolved: (CXF-2423) XSD generator fails to create @XmlRootElement

     [ https://issues.apache.org/jira/browse/CXF-2423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2423.
------------------------------

       Resolution: Invalid
    Fix Version/s: Invalid


Marking as "invalid" for two reasons:

1) If this was a bug, this would be a bug in JAXB and should be filed there: jaxb.dev.java.net.   CXF just delegates down to JAXB for all of this.  We don't actually generate these classes, they do.

2) This is probably not a jaxb bug either.   I THINK it only puts the XmlRootElement if the NAME of the element and the type are the same:


<xs:element name="note" type="note" /> 
<xs:complexType name="note"> 
.....

Alternatively, you would need a jaxb customization file with:
<jaxb:globalBinding generateElementClass="true">
to turn on generating a specific class for that element.





> 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
>             Fix For: Invalid
>
>
> 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.