I'm trying to convert the following XML to CSV using PowerShell 2.0, I can get some of the data out but when trying to go through the XML objects I can't seem to get just the data in a format that would allow me to make a good table.
What I have is something like this, with multiple item's
<root type="array"> <item type="object"> <short_version type="string">11</short_version> <long_name type="string">Internet Explorer</long_name> <api_name type="string">internet explorer</api_name> <long_version type="string">11.0.9600.16384.</long_version> <latest_stable_version type="string"></latest_stable_version> <automation_backend type="string">webdriver</automation_backend> <os type="string">Windows 2012 R2</os> </item> ... </root>
Either I end up with the Type or if I try and access the InnerHTML I get only the values, but in a long string.
I'm have so far:
[xml]$convertMe = Get-Content $jsonTemp
$convertMe.SelectNodes("//item") | % { $_.InnerText }
How can I get this in a nice CSV format like:
short_version,long_name,api_name,long_version,latest_stable_version,automation_backend,os 11,Internet Explorer,internet explorer,11.0.9600.16384,,webdriver,Windows 2012 R2