title: Why would a DOM Document show as null when it is actually valid?
body: <p>In one of my methods I have a DOM <code>org.w3c.dom.Document</code> instantiated and seems to be initialized properly since when I dump it using:</p>
  
  <pre><code>LOG.info("DOM: " + doc.getDocumentElement().getTextContent());
  </code></pre>
  
  <p>It outputs a valid and current content of a SOAP message that should be there.</p>
  
  <p>But only one statement before (and after), it shows as <code>null</code>:</p>
  
  <pre><code>LOG.info("doc BEFORE = " + doc);
  LOG.info("DOM: " + doc.getDocumentElement().getTextContent());
  LOG.info("doc AFTER: = " + doc);
  </code></pre>
  
  <p>They both show <code>null</code> with totally <strong>valid content in between</strong>.</p>
  
  <p>This doesn't make sense to me... What am I missing?</p>
  
  <hr>
  
  <p>Update, per the suggestions in the comments: I changed the log statements to </p>
  
  <pre><code>LOG.info("doc BEFORE/AFTER = " + doc + ", " + doc.toString() + ", " + (doc==null));
  </code></pre>
  
  <p>And the output is:</p>
  
  <blockquote>
    <p>INFO: doc BEFORE = [#document: null], [#document: null], false</p>
  </blockquote>
  
  <p>I therefore conclude that @qqilihq is right: The doc is not null, but doc.toString() is.</p>