title: Reading multiple XML Files via VB6
body: <p>I gotta import multiple huge xml data files into Excel. I cannot use the simple <code>loadXML()</code> function since Excel doesn't have enough RAM available. (some of the xml files are ~100mb)</p>
  
  <p>Now I've really tried out a lot... But couldn't really make it happen at all. 
  Example XML File:</p>
  
  <pre><code>&lt;OMDS xmlns="urn:omds20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:omds20 ./omds24-00.xsd"&gt;
     &lt;PAKET VUNr="1" MaklerID="2" PaketZpktErstell="x" PaketZpktLetztErstell="y"&gt;
        &lt;PROVISION ProvisionsID="123" Polizzennr="321" Vermnr="5" BuchDat="2013-02-27"/&gt;
        &lt;PROVISION ProvisionsID="456" Polizzennr="321" Vermnr="5" BuchDat="2013-02-27"/&gt;
        &lt;PROVISION ProvisionsID="789" Polizzennr="321" Vermnr="5" BuchDat="2013-02-27"/&gt;
     &lt;/PAKET&gt;
  &lt;/OMDS&gt;
  </code></pre>
  
  <p>So what I have in VBA is something like that: </p>
  
  <pre class="lang-vb prettyprint-override"><code>Sub ParseXmlDocument()
   Dim doc As New MSXML2.DOMDocument
   Dim success As Boolean
  
   success = doc.Load(App.Path &amp; "\test.xml")
   If success = False Then
      MsgBox doc.parseError.reason
   Else
     Dim nodeList As MSXML2.IXMLDOMNodeList
  
     Set nodeList = doc.selectNodes("/OMDS/PAKET/PROVISION")
  
     If Not nodeList Is Nothing Then
       Dim node As MSXML2.IXMLDOMNode
       Dim idAs String
       Dim value As String
  
       For Each node In nodeList
          id= node.selectSingleNode("ProvisionsID").Text
       Next node
     End If
    End If
  End Sub
  </code></pre>
  
  <p>After that I'm just trying to Print the ID within a <code>MsgBox</code>, but since the <code>nodeList</code> always appears to be empty, I can't make it happen.</p>
  
  <p>Hope someone can help me out. </p>
  
  <hr>
  
  <p>Thanks to GSerg i was able to solve the problem. Here the <strong>Solution</strong></p>
  
  <pre><code>Sub ParseXmlDocument()
      Dim doc As New MSXML2.DOMDocument
      Dim success As Boolean
  
    With doc
      .async = False
      .setProperty "SelectionLanguage", "XPath"
      .setProperty "SelectionNamespaces", "xmlns:t='urn:omds20'"
    End With
  
    success = doc.Load("C:\...\demo.xml")
  
   If success = False Then
      MsgBox doc.parseError.reason
   Else
  
   Dim nodeList As MSXML2.IXMLDOMNodeList
   Set nodeList = doc.SelectNodes("/t:OMDS/t:PAKET/t:PROVISION")
  
     If Not nodeList Is Nothing Then
       Dim node As MSXML2.IXMLDOMNode
       Dim id As String
       Dim value As String
  
     For Each node In nodeList
  
  
      id = node.SelectSingleNode("@ProvisionsID").Text
     Next node
    End If
   End If
  End Sub
  </code></pre>