IMPORT DATA: EXCEL to XML

Hi!

I would like to seek your expert advice.

I am tasked to do an XML data generator from an excel file. This XML data will be passed to the REST web service(in servoy) that will save the data to the tables.
I wanted the XML data to look like this(so the table hierarchy can be clearly seen):

<products>
<product>
  <id>1</id>
  <desc>Laptop</desc>
  <price>
    <amount>100</amount>
    <tax>12</tax>
   </price>
  <price>
    <amount>200</amount>
    <tax>15</tax>
   </price>
</product>
</products>

… and here is the excel sample that should be supplied.

id description amount tax
1 Laptop         100  12
1 Laptop         200 15
  1. Write a method that will read the excel file, place in dataset, traverse it and create the XML data manually. Is there an easier and simpler approach?

google excel to xml converter.

I rogel.

You can export excel to cvs from many different ways.

Best regards, Roberto Blasco.

(1) First match with “vbs xml to csv” google query

Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1

    FullName = objArgs(I)
    FileName = Left(objArgs(I), InstrRev(objArgs(I), ".") )

    Set objExcel = CreateObject("Excel.application")
    set objExcelBook = objExcel.Workbooks.Open(FullName)

    objExcel.application.visible=false
    objExcel.application.displayalerts=false

    objExcelBook.SaveAs FileName & "csv", 23

    objExcel.Application.Quit
    objExcel.Quit   

    Set objExcel = Nothing
    set objExcelBook = Nothing

Next

Roberto Blasco:

Best regards, Roberto Blasco.

I will look into JFlex. If there is a choice I would prefer not to create the XML data using strings. I am looking at JAXB. Any comments?

Thanks!

Roberto Blasco:

Best regards, Roberto Blasco.

Thanks! Please advice. I could not find a method in your jflex solution that automatically creates a dataset from the worksheet. In this case I would need to automatically create dataset by traversing the cell(rows/columns)?

Roberto Blasco:

Best regards, Roberto Blasco.

Can anyone help me?

I used jflex. Placed the following files in application_server>plugins.
jflex(folder)
jflex(jar)
jflex.jar(jnlp)

But am getting this error in Java Web Start. (JRE6)

#Found unsigned entry in resource: (http://localhost:8080/plugins/jflex.jar, 1295576386000)

Did I miss anything?

rogel:
But am getting this error in Java Web Start. (JRE6)
CODE: SELECT ALL
#Found unsigned entry in resource: (http://localhost:8080/plugins/jflex.jar, 1295576386000)

Did I miss anything?

Hi Rogel,

take a look here: http://wiki.servoy.com/display/public/tutorials/JAR+signing

Hope this helps

mboegem:

rogel:
But am getting this error in Java Web Start. (JRE6)
CODE: SELECT ALL
#Found unsigned entry in resource: (http://localhost:8080/plugins/jflex.jar, 1295576386000)

Did I miss anything?

Hi Rogel,

take a look here: http://wiki.servoy.com/display/public/tutorials/JAR+signing

Hope this helps

It worked. Thanks!