Java libraries for converting xsd to bean/objects [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.开发者_JAVA百科
Improve this questionWhat 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.
I used hyperjaxb to do this, worked perfectly.
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)
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
精彩评论