Let us discuss how to generate or create xml schema xsd from java class using jaxb in eclipse with below example.
1. Create a new JAXB project. File -> New -> Other -> JAXB -> JAXB Project.
2. Enter the project name and click on Finish button.
3. Download JAXB Jar and JAXB-XJC jar files and include in class path.
4. Create package which will contain xsd file.
5. Create package which will contain java classes.
6. Create a java class. Here we are using the java classes generated from previous example.
7. Right click on your package -> New -> Other -> JAXB -> Schema from JAXB Classes and click on Next.
8. Specify file name and location for new xsd file and click on Next.
9. Select java classes from which schema have to generated and click on Finish.
loading... com.w3spoint.javaclass.Address com.w3spoint.javaclass.ObjectFactory com.w3spoint.javaclass.Student generating schema... Schema D:\TestWorkspace\JAXBXSDTest2\src\com\w3spoint\xsd\test1.xsd generated