5

Is there a tool for converting an xsd in java class? I remember that I used one called xsd2java but I don't remember where it is.

Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106
michele
  • 26,348
  • 30
  • 111
  • 168

5 Answers5

4

You can use the XJC binding compiler

http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/2.0/jaxb/xjc.html

But it creates jaxb compliant java objects with annotations. So you would have to remove the jaxb stuff

rogermushroom
  • 5,486
  • 4
  • 42
  • 68
4

You can edit wsdl2java.bat OR wsdl2java.sh in axis installation folder and replace org.apache.axis2.wsdl.WSDL2Java with org.apache.axis2.schema.XSD2Java, better to saveAS wsdl2java.bat file to xsd2Java.bat

Fahad
  • 41
  • 1
3

Apache's XMLBeans: http://xmlbeans.apache.org/

Use scomp to generate Java classes from the desired schema.

Daniel Voina
  • 3,185
  • 1
  • 27
  • 32
1

see also https://issues.apache.org/jira/browse/CXF-3269 - perhaps this RFE will eventually lead to the shell script. But you can really copy wsdl2java and replace the java class - it works

1

Apache Axis has xsd2java.

There is an ANT task for wsdl2java, but I don't believe there is one for xsd2java.

xsd2java does have a main() method where you can specify the source schema and output location.

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147