title: Trying to get a value in an XML document at a given namespace and name using MSXML
body: <p>I have an XML document that looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;entry xml:base="https://sps.utility.abc123.com/sites/xyz/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:etag="&amp;quot;5&amp;quot;"&gt;
  &lt;id&gt;Web/Lists(guid'c920cb93-a31a-49a0-a4d6-ac1cb8fb0658')/Items(2)&lt;/id&gt;
  &lt;category term="SP.Data.REST_x0020_Test_x0020_ListListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /&gt;
  &lt;link rel="edit" href="Web/Lists(guid'c920cb93-a31a-49a0-a4d6-ac1cb8fb0658')/Items(2)" /&gt;
  &lt;title /&gt;
  &lt;updated&gt;2017-09-20T16:01:19Z&lt;/updated&gt;
  &lt;author&gt;
  &lt;name /&gt;
  &lt;/author&gt;
  &lt;content type="application/xml"&gt;
  &lt;m:properties&gt;
  &lt;d:Title&gt;item 2 has a new value.&lt;/d:Title&gt;
  &lt;/m:properties&gt;
  &lt;/content&gt;
  &lt;/entry&gt;
  </code></pre>
  
  <p>I want to get the value at the <code>&lt;d:Title&gt;</code> node, which in this case is <code>item 2 has a new value.</code></p>
  
  <p>When I use the following:</p>
  
  <pre><code>Private Function getFieldValueFromXml(xml As Variant, fieldName As String)
  
  Dim node As IXMLDOMNode
  Dim namespaceAndName As String
  Dim domDoc as MSXML2.DomDocument60    
  
  namespaceAndName = "d:" &amp; fieldName
  Set domDoc = New DOMDocument60
  Set node = domDoc.SelectSingleNode(namespaceAndName)
  getFieldValueFromXML = node.Text
  
  End Function
  </code></pre>
  
  <p>The <code>SelectSingleNode()</code> call throws this error:</p>
  
  <pre><code>Reference to undeclared namespace prefix: 'd'.
  </code></pre>
  
  <p>This also happens if I try to first set node with <code>m</code> as follows:</p>
  
  <pre><code>Set node = domDoc.SelectSingleNode("m:properties")
  </code></pre>
  
  <p>How can I get at the inner text of <code>&lt;d:Title&gt;</code> here?</p>