Nimble Coder

Adventures in Nimble Coding
posts - 77, comments - 50, trackbacks - 1

December 2011 Entries

Using PowerShell to Select a Unique Array

I had an XML file with names that I needed to verify in a database table, so I thought this would be a perfect task for PowerShell. The actual format of the XML file looked like this: <menu> <id>symbol:U_F80_T410.ADDITIONS</id> <name>ADDITIONS</name> <click>True</click> <en>True</en> </menu> Obtaining the XML nodes was simple with PowerShell. I need to find the symbol name, so I selected the <menu> nodes that had <id> nodes starting with 'symbol:' and extracted the name with Substring(): $menuSymbols = $xml.SelectNodes("//menu[contains(id, 'symbol:')]") | % { $_.id.Substring(7) } Next I need the tag name of each symbol (U_F80_T410 in the sample...

posted @ Friday, December 09, 2011 3:08 PM | Feedback (0) | Filed Under [ PowerShell ]

Powered by: