14 lines
446 B
PowerShell
14 lines
446 B
PowerShell
|
function Format-XML {
|
||
|
[CmdletBinding()]
|
||
|
param (
|
||
|
[Parameter(ValueFromPipeline=$true,Mandatory=$true)]
|
||
|
[string]$Xmlcontent
|
||
|
)
|
||
|
$xmldoc = New-Object System.Xml.XmlDocument
|
||
|
$xmldoc.LoadXml($Xmlcontent)
|
||
|
$sw = New-Object System.IO.StringWriter
|
||
|
$writer = New-Object System.Xml.XmlTextwriter($sw)
|
||
|
$writer.Formatting = [System.XML.Formatting]::Indented
|
||
|
$xmldoc.WriteContentTo($writer)
|
||
|
$sw.ToString()
|
||
|
}
|