title: PHP XPath. How to return string with html tags?
body: <pre><code>&lt;?php
      libxml_use_internal_errors(true);
      $html = '
  &lt;html&gt;
  &lt;body&gt;
      &lt;div&gt;
          Message &lt;b&gt;bold&lt;/b&gt;, &lt;s&gt;strike&lt;/s&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;span class="how"&gt;
              &lt;a href="link" title="text"&gt;Link&lt;/a&gt;, &lt;b&gt; BOLD &lt;/b&gt;
          &lt;/span&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
      ';
      $dom = new DOMDocument();
      $dom-&gt;preserveWhiteSpace = false;
      $dom-&gt;strictErrorChecking = false;
      $dom-&gt;recover = true;
      $dom-&gt;loadHTML($html);
  
      $xpath = new DOMXPath($dom);
      $messages = $xpath-&gt;query("//div");
      foreach($messages as $message)
      {
          echo $message-&gt;nodeValue;
      }
  </code></pre>
  
  <p>This code returns "Message bold, strike Link, BOLD " without html tags...</p>
  
  <p>I want to output the following code:</p>
  
  <pre><code>Message &lt;b&gt;bold&lt;/b&gt;, &lt;s&gt;strike&lt;/s&gt;
  
  &lt;span class="how"&gt;
       &lt;a href="link" title="text"&gt;Link&lt;/a&gt;, &lt;b&gt; BOLD &lt;/b&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>Can you help me?</p>