• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Do we have sample program for xlsx to XML ?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sample program for xlsx to XML .. I am trying to use xssf
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Can you tell us what you have tried so far? Can you already read xlsx files? Can you already write XML from other sources?
 
Ron Jean
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tried code

but not sure how to approach when data is nested nodes

Xlsx data looks like

CustomerID NAME First Name Lastname Address Orders Lineitems Itemname price
Record01 ABC A BC 123 001 01 Itemname01 2
02 Itemname02 5
Record02 CSF C CD 123 003 01 Itemname01 2


here next row has lineitems for first row (if more than 1 )

I need xml like
 
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ron Jean, please go through the faq how to UseCodeTags (<- link to click on). I have added them for you this time, and you see the code looks better instantly, doesn't it?

I see you named the method "displayFromExcel". But what actually it does? I'm afraid it does more than that, and that is the bad thing. Try to decompose your method into smaller methods, where each of them would do one and only one task, so your code could be readable by others.
 
Ron Jean
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apologies and Thanks Liutauras Vilda for formatting code .
displayFromExcel(String xlsPath) here i am trying to read from spreadsheet and write data into xml .

libraries used

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code you've written looks pretty good so far, although you need a lot more of it to take care of all the different types of elements in your desired output.
 
reply
    Bookmark Topic Watch Topic
  • New Topic