Today while consuming a REST service of one of my client, I got the response in XML format and what i needed was to generate POJO classes from that response. So I researched and sharing the 2 step way to do that :
1st step : Convert XML --> XSD
1st step : Convert XML --> XSD
2nd step : Convert XSD --> POJO (java classes)
Converting XML --> XSD
I have used trang.jar for this task. Link.
command (usage)
Converting XSD --> POJO (java classes)
For this i have used following executable
<JAVA_HOME>\bin\xjc.exe (jdk1.6.0_13 in my case.)
command (usage)
------------------------------------------------------------------
Sometimes the above command throws an error like following
Following command can get you out of the above error or you can use custom bindings.
xjc -XautoNameResolution PurchaseOrders.xsd
Converting XML --> XSD
I have used trang.jar for this task. Link.
command (usage)
java -jar trang.jar file.xml file.xsd
Converting XSD --> POJO (java classes)
For this i have used following executable
<JAVA_HOME>\bin\xjc.exe (jdk1.6.0_13 in my case.)
command (usage)
xjc file.xsd
------------------------------------------------------------------
Sometimes the above command throws an error like following
XJC |
Following command can get you out of the above error or you can use custom bindings.
xjc -XautoNameResolution PurchaseOrders.xsd
0 nhận xét:
Đăng nhận xét