I'm trying to remove node "A"
$xml=@"
<migrationManifests>
<file>A</file>
<file>B</file>
<file>C</file>
<file>D</file>
<file>E</file>
<file>F</file>
</migrationManifests>
"@
$data = -join("/migrationManifests[@file='A']")
$node = $xml.SelectSingleNode($data)
$null = $node.ParentNode.RemoveChild($node)
$xml.migrationManifests.file
And I get this error:
You cannot call a method on a null-valued expression.
Any ideas how to do it?