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
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
-
FatcaXML_v2.0.xsd (The main XSD files)
-
isofatcatypes_v1.1 (file imported in FatcaXML_v2.0.xsd file)
-
oecdtypes_v4.2 (file imported in FatcaXML_v2.0.xsd file)
-
stffatcatypes_v2.0 (file imported in FatcaXML_v2.0.xsd file)
Step-1:
Open the command prompt and go to the XSD files directory
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.