Tuesday, June 9, 2015

MS Powershell and XML element tags named "item".

Being rather new to MS Powershell, and still learning the ropes with it, I recently ran into a novice problem with an xml document having element tags named "item". This xml document was to be parsed and handled by Powershell.

The problem was that when calling those nodes named "<item>...</item>"  using the object-oriented dot notation, it conflicted with the "Item()" method provided to xml objects by Powershell. 

The solution was to use the following ...



$collectionNodes.GetElementsByTagName( 'item' );


If anyone is facing the same problem I did, I hope this helps.