title: how to extract text from an element in an xml string in classic asp
body: <p>I have the following xml:</p>
  
  <pre><code>&lt;GetPurchaseContractResponse xmlns="http://payments.amazon.com/checkout/v2/2010-08-31/"&gt;
      &lt;GetPurchaseContractResult&gt;
          &lt;PurchaseContract&gt;
              &lt;Id&gt;amzn1.contract.1.1.1.d6779be6bf481167fe945&lt;/Id&gt;
              &lt;State&gt;ACTIVE&lt;/State&gt;
              &lt;MerchantId&gt;XXXXXXXXXX&lt;/MerchantId&gt;
              &lt;ExpirationTimeStamp&gt;2012-07-19T10:55:28.134Z&lt;/ExpirationTimeStamp&gt;
              &lt;MarketplaceId&gt;A1SDFERWERSDF&lt;/MarketplaceId&gt;
          &lt;/PurchaseContract&gt;
      &lt;/GetPurchaseContractResult&gt;
      &lt;ResponseMetadata&gt;
          &lt;RequestId&gt;0db53477-d17a-11e1-ac3e-fd3e0de62222&lt;/RequestId&gt;
      &lt;/ResponseMetadata&gt;
  &lt;/GetPurchaseContractResponse&gt;
  </code></pre>
  
  <p>I want to extract the content of the ExpirationTimeStamp element.</p>
  
  <p>Here is the relevant piece of my code (yes we're using jscript and not vbscript):</p>
  
  <pre><code>var xmlDoc = Server.CreateObject("Msxml2.DOMDocument.6.0");
  xmlDoc.loadXML(xml);
  var expNode = xmlDoc.getElementsByTagName("ExpirationTimeStamp");
  if (expNode)
      Response.Write(expNode.text);
  </code></pre>
  
  <p>I have also tried selectSingleNode instead of getElementsByTagName</p>
  
  <p>I have tried GetPurchaseContractResponse/GetPurchaseContractResult/PurchaseContract/ExpirationTimeStamp as the xpath string with none, one and two leading forward slashes</p>
  
  <p>Response.Write(xmlDoc.xml) outputs the entire document, so it is loading fine.</p>
  
  <p>The expNode variable doesn't get anything in it.</p>
  
  <p>My knowledge of xpath is next to nothing, so I'm sure some expert out there can point out the simple mistake I am making.</p>