Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1077
  • Last Modified:

Unable to convert xml file into CSV or import to Excel / Access

I have the attached XML file which looks great in my browser but I need force the list of objects into a DB table or spreadsheet.  How can I do this? It did not work correctly when importing directly into access/excel.
Report.xml
0
canuckconsulting
Asked:
canuckconsulting
  • 4
  • 3
1 Solution
 
Jared_SCommented:
I was able to open it just fine by just right clicking it and opening it with excel.
reportxml.xlsx
0
 
canuckconsultingAuthor Commented:
If you look at the xml itself it hasn't done this in a helpful way.  I need to have the following xml entries as  columns:

EPOLeafNode.NodeName
EPOComputerProperties.IPV6
EPOComputerProperties.OSPlatform
EPOProdPropsView_EPOAGENT.productversion
EPOProdPropsView_VIRUSCAN.enginever
EPOProdPropsView_VIRUSCAN.datver
EPOLeafNode.LastUpdate
0
 
tdlewisCommented:
Excel is loading the XML as generated. You will need some code to transform the data. This code could either transform the source XML into new XML that matches the view you want of the data or it could transform the table as loaded into Excel into the view that you want.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
canuckconsultingAuthor Commented:
Thanks.  i am using Visual Studio 2010 and c# here.  Can you please direct me to some helpful examples?
0
 
tdlewisCommented:
Here's some pseudo code that should do what you want:
foreach report in reports
  foreach results in report
    foreach header in report.object-header
      column[header.name] = header.property
      cell[1,index(column[header.name])].value = header.property
    next header
    row = 2
    foreach item in report.object
      foreach prop in item.property
        cell[row,index(column[prop.name])].value = prop.value
      next prop
      row++
    next item
  next results
next report

Open in new window

0
 
canuckconsultingAuthor Commented:
Cheers for that.

I have not worked with xml as an object before.  Can you advise what .Net class or classes I should be using to be able to iterate through the file?
0
 
tdlewisCommented:
0
 
canuckconsultingAuthor Commented:
Thanks for the help!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now