title: Append HTML Strings to DOMDocument at start and end of DOMXPath
body: <p>Here is my block of html</p>
  
  <pre><code>$html = '&lt;div class="importantnoticediv"&gt;
              &lt;p class="important-notice-title important-notice-title-1"&gt;
                  NOTICE:
              &lt;/p&gt;
              &lt;p class="important-notice-title important-notice-title-2"&gt;
                  PROFESSIONAL INSTALLATION IS RECOMMENDED!
              &lt;/p&gt;
          &lt;/div&gt;';
  </code></pre>
  
  <p>I'm able to initiate a new <code>DOMDocument</code> and target this specific DIV class using <code>DOMXpath</code></p>
  
  <pre><code>$dom = new DOMDocument;
  $dom-&gt;loadHTML($post_content);
  $xpath = new DOMXpath($dom);
  $importantnotice = $xpath-&gt;query('//div[contains(@class, "importantnoticediv")]');
  $indiv = $importantnotice-&gt;item(0);
  </code></pre>
  
  <p>I'm having a very hard time figuring out how to append the HTML I want to this class, though.</p>
  
  <p>Here's what I'm trying to transform my block of html into:</p>
  
  <pre><code>&lt;div class="importantnoticediv"&gt;
      &lt;div class="note-icon note-icon-important"&gt;
          &lt;span&gt;&lt;i class="fa fa-exclamation" aria-hidden="true"&gt;&lt;/i&gt;
          &lt;/span&gt;
      &lt;/div&gt;
      &lt;div class="note-text note-text-important"&gt;
          &lt;p class="important-notice-title important-notice-title-1"&gt;
                  NOTICE:
          &lt;/p&gt;
          &lt;p class="important-notice-title important-notice-title-2"&gt;
                  PROFESSIONAL INSTALLATION IS RECOMMENDED!
          &lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So, in other words,</p>
  
  <pre><code>&lt;div class="note-icon note-icon-important"&gt;
      &lt;span&gt;&lt;i class="fa fa-exclamation" aria-hidden="true"&gt;&lt;/i&gt;
      &lt;/span&gt;
  &lt;/div&gt;
  &lt;div class="note-text note-text-important"&gt;
  </code></pre>
  
  <p>Immediately after my <code>&lt;div class="importantnoticediv"&gt;</code> as well as add a closing <code>&lt;/div&gt;</code> at the very end of this div class.</p>
  
  <p>Is this even possible with <code>DOMDocument</code> and <code>DOMXpath</code>? Given that what I am trying to add isn't "valid" html (even though it is, once I do the two steps..)
  I understand I can create new elements, but how do I insert just a custom html string immediately after the start and end of my chosen <code>DOMDocument</code>/<code>DOMXpath</code>?</p>