Insert an element with multiple attributes : I'd like to add this line to my xml file under system.web tag <machineKey decryption="AES" validation="SHA1" />

XML File:

<system.web>
    <httpRuntime maxRequestLength="1024000" executionTimeout="600" requestValidationMode="2.0" />
    <pages smartNavigation="false" validateRequest="true" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
    <compilation defaultLanguage="vb" debug="false" targetFramework="4.5" />
    <customErrors defaultRedirect="~/Error/Redirect.aspx" mode="On" redirectMode="ResponseRewrite" />
    <authorization>
      <allow users="" />
    </authorization>
    <trace enabled="false" requestLimit="25" pageOutput="true" traceMode="SortByTime" localOnly="true" />
    <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="30" />
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    <httpHandlers>
      <add verb="*" path="Compare.aspx" type="kCura.EDDS.WebAPI.Compare, kCura.EDDS.WebAPI" />
    </httpHandlers>
    <webServices>
      <protocols>
        <add name="HttpPost" />
        <remove name="HttpGet" />
        <remove name="Documentation" />
      </protocols>
    </webServices>
  </system.web>
  <system.webServer>


Was able to add a single attribute using these steps:

$ChildElement = $xmlDoc.CreateElement('machineKey');
$ChildElement.SetAttribute('decryption','False')
$xmlDoc.configuration.'system.web'.InsertBefore($ChildElement,$xmlDoc.configuration.'system.web'.authentication)
$xmlDoc.Save($fileName)

Thanks in advance!

