How to use JAXB APIs to generate classes from xsd?
- by Simran
I need to generate bean classes from .xsd without using xjc command or ant. i have found the implementation in Apache Axis2 but i am unable to generate the artifacts.
i have written the following code but i get NullPointerException :
SchemaCompiler sc = XJC.createSchemaCompiler();
URL url = new URL("file://E:\\JAXB\\books.xsd");
sc.parseSchema(new InputSource(url.toExternalForm()));
S2JJAXBModel model = sc.bind();
JCodeModel cm = model.generateCode(null, null);
cm.build(new FileCodeWriter(new File("E:\\JAXBTest")));
Can anyone help me / provide some links???