title: How can I determine why a call to IXMLDOMDocument::load() fails?
body: <p>I am trying to debug what appears to be an XML parsing issue in my code.  I have isolated it down to the following code snippet:</p>
  
  <pre><code>HRESULT
  CXmlDocument::Load(IStream* Stream)
  {
      CComVariant xmlSource(static_cast&lt;IUnknown*&gt;(Stream));
      VARIANT_BOOL isSuccessful;
    * HRESULT hr = m_pXmlDoc-&gt;load(xmlSource, &amp;isSuccessful);
      return (hr == S_FALSE) ? E_FAIL : hr;
  }
  </code></pre>
  
  <p><strong>Note:</strong> <code>m_pXmlDoc</code> is of the type <code>CComPtr&lt;IXMLDOMDocument&gt;</code>.</p>
  
  <p>It appears that the call to <code>IXMLDOMDocument::load()</code> (marked with the *) is failing - IOW, it is returning <code>S_FALSE</code>.</p>
  
  <p>I am not able to step into <code>load()</code> to determine why it is failing, as it is a COM call.</p>
  
  <p>The <a href="http://msdn.microsoft.com/en-us/library/ms762722%28VS.85%29.aspx" rel="noreferrer">MSDN page</a> for this method doesn't seem to be giving a lot of insight.</p>
  
  <p>I have a few hunches:</p>
  
  <ul>
  <li>The XML is not well-formed</li>
  <li>The XML file is too large (approximately 120MB)</li>
  <li>It is a memory-related issue (the process size gets to > 2GB at the time of failure)
  
  <ul>
  <li><em>NB:</em> A registry key has been set to allow the process size to be this large, as the largest valid process size for WinXP, AFAIK, is 2GB).</li>
  </ul></li>
  </ul>
  
  <p>Any ideas as to why this call could be failing?</p>