Via an Rest-API call I receive an XML file in Powershell.
#calling the REST service and get XML result
$xml = try {
Invoke-RestMethod -Uri $url -ErrorAction Stop
} catch {
LogWrite "An exception was caught: $($formatstring -f $fields)";
exit;
}
I then remove nodes by using removeChild().
#manipulate XML
$xml.SelectNodes("//XPathQuery").ParentNode.RemoveChild(...)
Finally I save the manipulated XML.
#save XML
$xml.Save("$targetDirectory\$filename");
The resulting XML-file has multiple empty lines.
I assume that each removed note resulted in one additional empty line. How can this be avoided?
