How to convert Excel to XML using java?

前端 未结 5 1791
抹茶落季
抹茶落季 2020-12-04 03:45

i want to convert my input Excel file into the Output XML file.

If anybody has any solution in java for how to take input Excel file and how to write to XML as outpu

5条回答
  •  攒了一身酷
    2020-12-04 04:25

    I have done conversion of Excel(xlsx) to xml in Java recently. I assumed each row in excel as a single object here. Here are the steps I followed:-

    1. Read Excel file using Apache POI
    2. Created a xsd file and generated corresponding classes
    3. Read each row created, created corresponding objects and initilaized values using the generated getter/setter methods in the classes
    4. Added the objects to an arraylist which holds only objects the same type
    5. Using Jaxb Marshelled the arraylist object to an output file

    Ready to provide code if required Here's where you can start https://sites.google.com/site/arjunwebworld/Home/programming/jaxb-example

提交回复
热议问题