我将如何<Description>
在以下 xmla 文件(xmla = Microsoft Analysis Services)中添加一个带有其值的标签作为子元素<Object>
?
这只是将它添加到文件的末尾,而不是在<Object>
.
$ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$ns.AddNamespace("d", $xml.DocumentElement.NamespaceURI)
$xml.SelectSingleNode("//d:Database/d:Description", $ns)
$xmlElt = $xml.CreateElement("Description")
$xmlText = $xml.CreateTextNode("Mach1")
$xmlElt.AppendChild($xmlText)
$xml.FirstChild.AppendChild($xmlElt);
$xml.SelectSingleNode("//d:Database/d:Description", $ns)
$xml.Save("test.xml")
这是 xmla(顶部):
<Batch Transaction="false" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Alter AllowCreate="true" ObjectExpansion="ExpandFull">
<Object>
<DatabaseID>CRH_TA1</DatabaseID>
</Object>
<ObjectDefinition>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400">
<ID>CRH_TA1</ID>
<Name>CRH_TA1</Name>
<DataSourceImpersonationInfo>
<ImpersonationMode>ImpersonateAccount</ImpersonationMode>