opening/saving xml while preserving newline between node's attributes

DebraFarloy

New Member
This is what I have so far:\[code\]$XML = New-Object System.Xml.XmlDocument$XML.PreserveWhitespace = $true$XML.Load($path)#change some node attributes$XML.Save($path)\[/code\]If I take open an xml file, and take a snippet like this:\[code\]<Node Name="tyjytj" Number="rthjr" Source="rjyrtjrjrtj" BinaryDrive="teheherhehtr" />\[/code\]It will save it like this:\[code\]<Node Name="tyjytj" Number="rthjr" Source="rjyrtjrjrtj" BinaryDrive="teheherhehtr" />\[/code\]But I want to be able to change (for example) the Name of the Node, while keeping newlines between each attribute. I want the format to remain exactly how it was before I open/saved it.
 
Back
Top