I'm adding related elements (Parent-Child) through an XML file using the following:
[xml]$fileXml = Get-Content 'c:\example.xml'
$fileXml.Elements | % {
MyAdd-Function $_
}
When deleting these elements, how do I make sure it iterates in the reverse order? I've tried this and it doesn't work:
[xml]$fileXml = Get-Content 'c:\example.xml'
[Array]::Reverse($fileXml.Elements) | % {
MyRemove-Function $_
}
I'm thinking about turning $fileXml.Elements into an actual array and then reversing, but I was wondering if there's an easier way.