Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Created March 29, 2016 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eristoddle/f675a0c784133944198ccfca7ed6335d to your computer and use it in GitHub Desktop.
Save eristoddle/f675a0c784133944198ccfca7ed6335d to your computer and use it in GitHub Desktop.
Powershell script to parse xml in csv and expand it
$records = Import-Csv BadResults.csv
foreach($record in $records){
$xml = new-object System.Xml.XmlDocument
$fraudScore = $record.FraudScoreDetails
$xml.LoadXml($fraudScore)
foreach ($i in $xml.response.rule){
#Write-Output $i.criteriaEvaluated
#Write-Output $i.evaluationResult
$record | Add-Member NoteProperty $i.criteriaEvaluated $i.evaluationResult
}
}
$records | Export-Csv -Path ExpandedBadResults.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment