title: DOMDocument createelement with value as html
body: <p>I have a problem with DOMDocument class.</p>
  <p>I need to pass to DOMDocument::createElement method HTML as a value of element.</p>
  <p>I have, a class which builds a schedule for events and one method of this class have the code like that:</p>
  <pre><code>$label = $this-&gt;list-&gt;createElement('label', $this-&gt;getEventDescription($event));
  </code></pre>
  <p>Like you see I'm creating label with event description, but the structure of this description is dependent on event and sometimes includes other HTML tags such as <code>&lt;i&gt;</code> <code>&lt;span&gt;</code>. At the moment, when I do it the way above, the HTML code is not interpreted, but displayed as text, which is not my desired result.</p>
  <p>Is it possible for the createElement method to interpret this html and create it as a node so that my getEventDescription method can still return a string?</p>
  <p>I've been tried that:</p>
  <pre><code>$label = $this-&gt;list-&gt;createElement('label');
  $description = new DOMDocument('1.0');
  $description-&gt;loadHTML($this-&gt;getEventDescription($event));
  $label-&gt;appendChild($description);
  </code></pre>
  <p>But it's failed because of <code>Wrong Document Error</code></p>