Public/Export-XmlNode.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Export-XmlNode {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [System.Xml.XmlElement]
        $Xml
        ,
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]
        $Path
    )

    $NewXml = New-Object -TypeName System.Xml.XmlDocument
    $null = $NewXml.AppendChild($NewXml.ImportNode($Xml, $true))
    $NewXml.Save($Path)
}