title: Child elements inheriting parent attribute through VBA
body: <p>I am working on an xml output from excel 2013, I have set a reference to the XML v6 library but I am not getting the results I expect.
  This is the code I am using:</p>
  
  <pre><code>Sub testXML()
  
  Dim dom, node, attr, PCMS, SendPCMS, header
  
  Set dom = CreateDom
  Set node = dom.createProcessingInstruction("xml", "version='1.0' encoding='utf-8'")
  dom.appendChild node
  Set node = Nothing
  
  Set PCMS = dom.createElement("PCMS")
  Set attr = dom.createAttribute("xmlns")
  attr.Value = "MyNamespace"
  PCMS.setAttributeNode attr
  Set attr = Nothing
  dom.appendChild PCMS
  
  Set SendPCMS = dom.createElement("SendPCMSManifest")
  PCMS.appendChild SendPCMS
  Set header = dom.createElement("header")
  PCMS.appendChild header
  
  dom.Save "C:\Temp\DomTest.xml"
  
  End Sub
  Private Function CreateDom()
  Dim dom
  Set dom = New DOMDocument
  dom.async = False
  dom.validateOnParse = False
  dom.resolveExternals = False
  dom.preserveWhiteSpace = True
  Set CreateDom = dom
  End Function
  </code></pre>
  
  <p>For some reason, the attribute "xmlns" is also being applied to the child elements (but only the attribute name, not the value) as per below output:</p>
  
  <pre><code>?xml version="1.0" encoding="UTF-8"?&gt;
  PCMS xmlns="MyNamespace"&gt;
   SendPCMSManifest xmlns=""/&gt;
   header xmlns=""/&gt;
  /PCMS&gt;
  </code></pre>
  
  <p>Can anybody show me where I am going wrong? The elements "SendPCMSManifest" &amp; "header" should not have the "xmlns=" in the node name</p>
  
  <p>edited: trying to get example output xml showing</p>