views:

182

answers:

4

What are my options for libraries to convert XSD files to java beans or objects? I have a large XSD that I have been trying to convert using JAXB2, but JAXB2 is creating invalid classes.

+1  A: 

You can give a try with castor,

Hope this could help you http://stackoverflow.com/questions/686453/generate-java-classes-from-xsd-files

Jayachandran
+1  A: 

I used hyperjaxb to do this, worked perfectly.

Freedo
A: 

tried using xml beans, but run into an error - name is too long:

target/generated-sources/xmlbeans/net/juniper/xml/iveSa/x65R31/impl/ConfigurationDocumentImpl.java:643340: error while writing net.juniper.xml.iveSa.x65R31.impl.ConfigurationDocumentImpl.ConfigurationImpl.UsersImpl.ResourcePoliciesImpl.NetworkConnectPoliciesImpl.NetworkConnectNodeSpecificConfigurationImpl.NetworkConnectConnectionProfilesImpl.NetworkConnectConnectionProfileImpl.DhcpOptionsImpl.DhcpOptionImpl.OptionNumberImpl: /target/generated-classes/xmlbeans/net/juniper/xml/iveSa/x65R31/impl/ConfigurationDocumentImpl$ConfigurationImpl$UsersImpl$ResourcePoliciesImpl$NetworkConnectPoliciesImpl$NetworkConnectNodeSpecificConfigurationImpl$NetworkConnectConnectionProfilesImpl$NetworkConnectConnectionProfileImpl$DhcpOptionsImpl$DhcpOptionImpl$OptionNumberImpl.class (File name too long)
wuntee
A: 

You can use the binding compiler that comes with the JAXB 2.x versions to create the classes for each complex element in your XSD. If you don't want to use the command-line to call the binding compiler, you can use the JAXB Workshop XJC plugin for Eclipse or IntelliJ IDEs which will generate the classes at the click of a button.

Regards,
Nagendra U M

Nagendra U M