title: Reference to undeclared namespace prefix
body: <p>I have an XML file looking like this: </p>
  
  <pre><code>&lt;xc:XmlCache xmlns:xc="XmlCache" xmlns:mp="mx.MarketParameters" xmlns:rt="mx.MarketParameters.Rates" xmlns:rtcu="mx.MarketParameters.Rates.Curve"&gt;
      &lt;xc:XmlCacheArea xc:value="MarketParameters"&gt;
          &lt;mp:nickName xc:value="MDS" xmlns:mp="mx.MarketParameters"&gt;
              &lt;mp:date xc:value="20160518"&gt;
                  &lt;rt:rate xmlns:rt="mx.MarketParameters.Rates"&gt;
                      &lt;rtcu:curve xmlns:rtcu="mx.MarketParameters.Rates.Curve"&gt;
                          &lt;rtcu:currency xc:value="AED"&gt;
                              &lt;rtcu:label xc:value="AED FX"&gt;
                                  &lt;rtcu:type xc:value="Swap point"&gt;
                                      &lt;rtcu:generator xc:value="USD/AED"&gt;
                                          &lt;rtcu:market xc:value=""&gt;
                                              &lt;rtcu:maturity xc:value="10M" xc:dates="20160523-20170323" xc:type="Fields"&gt;
  </code></pre>
  
  <p>I would like to get a list of nodes of type <code>rtcu:maturity</code> in VBA to perform some operations:</p>
  
  <pre><code>Dim xmlCurvesFileDOMDocument As New DOMDocument60
  Dim listOfMaturities As IXMLDOMNodeList
  
  xmlCurvesFileDOMDocument.Load (xmlCurvesFilePath)
  Set listOfMaturities = xmlCurvesFileDOMDocument.SelectNodes("//xc:XmlCache/xc:XmlCacheArea/mp:nickName/mp:date/rt:rate/rtcu:curve/rtcu:currency/rtcu:label/rtcu:type/rtcu:generator/rtcu:market/rtcu:maturity")
  </code></pre>
  
  <p>(note: I'm omitting <code>xmlCurvesFilePath</code>but it's correct, the file is loaded). </p>
  
  <p>When I run this, on the set of <code>listOfMaturities</code> I get an error of type <code>Reference to undeclared namespace prefix: 'xc'</code>. If I remove <code>xc</code> from the path, it will tell me the problem is the other one (<code>mp</code>). If I remove <strong>all</strong> the namespaces from the XPath, it works but it loads nothing. </p>
  
  <p>I've tried to search stack overflow and it seems that the solution would be to set the Selection Name spaces (like <a href="https://stackoverflow.com/questions/45404020/xpath-syntax-to-select-nodes-with-multiple-attributes-in-the-path">here</a> and <a href="https://stackoverflow.com/questions/2811053/undeclared-reference-to-namespace-prefix-error">here</a>).</p>
  
  <p>However, when I try to do that: </p>
  
  <pre><code>xmlCurvesFileDOMDocument.setProperty("SelectionNamespaces", "xmlns:xc='XmlCache'")
  </code></pre>
  
  <p>... I get a compile error telling me "<code>Expected : =</code>". </p>
  
  <p>Does anyone have an idea on how I can declare my namespaces and parse this XML file? </p>