I have the following stub XML file
<ResourceDictionary x:Uid="CultureResources"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<system:String x:Uid="system::.CultureName" x:Key=".CultureName">de-DE</system:String>
</ResourceDictionary>
I am tying to auto generate it in the same manner it is currently displayed with the following test code
[xml]$xmlfile = Get-Content "c:\test.xml"
[System.Xml.XmlNamespaceManager] $nsm = new-object System.Xml.XmlNamespaceManager $xmlfile.NameTable
$nsm.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml")
$nsm.AddNamespace("system", "clr-namespace:System;assembly=mscorlib")
$nn = $xmlfile.CreateElement("system:String", $nsm)
$nn.set_InnerText("de-DE")
$nn.SetAttribute("Uid","system:.CultureName")
$nn.SetAttribute("Key",".CultureName")
$xmlfile.ResourceDictionary.AppendChild($nn)
But the output I am getting is
<ResourceDictionary x:Uid="CultureResources"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<system:String x:Uid="system::.CultureName" x:Key=".CultureName">de-DE</system:String>
<system:String Uid="system:.CultureName" Key=".CultureName" xmlns:system=" xmlns xml x system">de-DE</system:String>
</ResourceDictionary>
How do I:
A) get rid of the namespace text
xmlns:system=" xmlns xml x system"
B) prefix my Attributes with "x:"
Any help would be appreciated.
Regards,
Ryan