Thursday, April 2, 2015

XML Parsing in Powershell

Get the schema in xml
[xml]$xml = Get-Content .\acesdata.xml

Open up the file in excel as an XML Source Task Pane to find which node you are going to start parsing












In this example the Node will be Header and the fields I want to parse are Company, TransferDate, and EffectiveDate

























Run the following command to parse the data
$xml.SelectNodes('//Header') | Select Company,TransferDate,EffectiveDate |Export-csv aces.csv


No comments:

Post a Comment