Generate Java code using XML Schema

Many tools are available regarding XMLBeans: XMLBeans Tools 
Here I only copied description of scomp which compiles schema to JAVA code. I already described how to get xsd from xml file here.

Generate Java code from XSD

If you want to get right to it with your own XML schema and instance, follow these basic steps:

  1. Install XMLBeans.
  2. Compile your schema. Use scomp to compile the schema, generating and jarring Java types. For example, to create a employeeschema.jar from an employeesschema.xsd file:
    scomp -out employeeschema.jar employeeschema.xsd
  3. Write code. With the generated JAR on your classpath, write code to bind an XML instance to the Java types representing your schema. Here's an example that would use types generated from an employees schema:
    File xmlFile = new File("c:\employees.xml"); 
    
    // Bind the instance to the generated XMLBeans types.
    EmployeesDocument empDoc = 
     EmployeesDocument.Factory.parse(xmlFile); 
    
    // Get and print pieces of the XML instance.
    Employees emps = empDoc.getEmployees(); 
    Employee[] empArray = emps.getEmployeeArray(); 
    for (int i = 0; i < empArray.length; i++) 
    { 
     System.out.println(empArray[i]); 
    }

Read a tutorial.

Read their tutorial to get a sense of XMLBeans basics.

***