To generate the Java class objects from XML Schema Definition (XSD) using the command line the following step can be used:

Pre-requisite

Java JDK 1.8


XSD files directory xsd_folder


Multiple XSDs

In case there are multiple XSD files from which you want to generate the Java class object then you have to use the main file where the other files are imported.

In this example we are using multiple XSD files

  1. FatcaXML_v2.0.xsd (The main XSD files) main XSD

  2. isofatcatypes_v1.1 (file imported in FatcaXML_v2.0.xsd file) isofactatypes_v_1_1

  3. oecdtypes_v4.2 (file imported in FatcaXML_v2.0.xsd file) oecdtypes_v4

  4. stffatcatypes_v2.0 (file imported in FatcaXML_v2.0.xsd file) stffatcatypes-xsd


Step-1:

Open the command prompt and go to the XSD files directory xsd_folder_cmd_prompt

Step-2:

Execute the below mention command in the console. NOTE: Change the xjc.exe file path as per your environment.

C:\Program Files\Java\jdk1.8.0_172\bin\xjc.exe FatcaXML_v2.0.xsd

After executing the above command the following output is generated.

XSD to Java