title: How do i clone all children from specific node
body: <p>Preface: This is my first interaction with .Net and XML data manipulation.</p>
  
  <p>I need help with cloning all the children form a specific node (<code>&lt;MonitoringData&gt;</code>) and all of it's children. There are 15 instances of the node <code>&lt;MonitoringData&gt;</code> that will need to be cloned. Eventually I will need to insert data from an access DB into a few of the children of <code>&lt;MonitoringData&gt;</code> but I'll figure that out once I get there. </p>
  
  <p>XML Document looks as follows:</p>
  
  <pre><code>&lt;MetaData&gt;
  &lt;MonitoringData type="Sample"&gt;
  .....few other children
  &lt;IndividualMonitoringResult&gt;
  &lt;IndividualResult&gt;
  &lt;MonitoringStartDate&gt;2019-04-01&lt;/MonitoringStartDate&gt;
  &lt;MeasurementQualifier/&gt;
  &lt;MeasurementValue/&gt;
  &lt;LimitOfDetection/&gt;
  &lt;LimitOfQuantification/&gt;
  &lt;MeasurementUnit&gt;mg/L&lt;/MeasurementUnit&gt;
  &lt;LaboratoryCertificationNo/&gt;
  &lt;QCExceedance/&gt;
  &lt;OrganicsAnalyzedDate/&gt;
  &lt;/IndividualResult&gt;
  &lt;/IndividualMonitoringResult&gt;
  &lt;/MonitoringData&gt;
  &lt;MonitoringStartDate&gt;2019-04-02&lt;/MonitoringStartDate&gt;
  &lt;MeasurementQualifier/&gt;
  &lt;MeasurementValue/&gt;
  &lt;LimitOfDetection/&gt;
  &lt;LimitOfQuantification/&gt;
  &lt;MeasurementUnit&gt;mg/L&lt;/MeasurementUnit&gt;
  &lt;LaboratoryCertificationNo/&gt;
  &lt;QCExceedance/&gt;
  &lt;OrganicsAnalyzedDate/&gt;
  &lt;/IndividualResult&gt;
  &lt;/IndividualMonitoringResult&gt;
  &lt;IndividualResult&gt;
  &lt;IndividualMonitoringResult&gt;
  ...Duplication for each day of month
  &lt;/IndividualResult&gt;
  &lt;/IndividualMonitoringResult&gt;
  &lt;MonitoringData&gt;
  ....Duplication of last MonitoringData
  &lt;/MonitoringData&gt;
  &lt;/MetaData&gt;
  </code></pre>
  
  <p>This is the code I currently have. The exception I receive is 'Expression must evaluate to a node-set'</p>
  
  <pre><code>    Dim xdc As New XmlDocument
      xdc.Load(GlobalVariables.strXMLFileName)
      Dim strXPATH As String = "/u:eDMR/u:Submission/u:Facility/u:Report/u:MonitoringLocationGroup/u:MonitoringData/"
      Dim nsmgr As New XmlNamespaceManager(xdc.NameTable)
      nsmgr.AddNamespace("u", xdc.DocumentElement.NamespaceURI)
      Dim xnl As XmlNodeList = xdc.DocumentElement.SelectNodes(strXPATH, nsmgr)
      For Each xnd As XmlNode In xnl
          xnd.CloneNode(True)
      Next
  </code></pre>
  
  <p>I understand that the code I've presented is intended to locate a single child of a parent and then clone it. I cannot for the life of me figure out how to grab the whole node.
  I found a solution but it's in C#.
  <a href="https://stackoverflow.com/questions/36185463/how-to-make-a-copy-of-a-xml-node-with-all-their-child-nodes-and-values-but-diffe">How to make a copy of a XML node with all their child nodes and values but different name C# .NET</a></p>
  
  <p>Expected result would be to grab all of the children of node <code>&lt;MonitoringData&gt;</code> in memory to which I will then insert data into a few of the children. I'll figure data insertion out on my own. I would like help figuring out how to grab all of the children of a particular node.</p>