DomDocument, insert HTML Element

[email protected] (Martel Valgoerad) Fri, 12 Nov 2004 11:06:52 +0100
Newsgroups php.xml.dev
Message-ID <[email protected]>
Hi, I have a problem I can't really resolve myself. It would be great if
someone could give me some hints.

I have a DomDocument created with:

$doc = new DomDocument('1.0', 'UTF-8');
$doc->resolveExternals = true;
$doc->substituteEntities = true;

And then I wish to add $HTML which is taken directly from the database (so I
don't have any influence on the content - but I am sure that's a well formed
xhtml):

$art = $doc->createElement('article');
$art->setAttribute('id', 2335);
  
$HTML = 'Some kind of <a href="http://cos.com">HTML</a>';
$body = $doc->createElement('body', $HTML);
$art->appendChild($body);
  
$doc->appendChild($art);

var_dump::display($this->doc->saveXML());

Var dump gives:

<?xml version="1.0" encoding="UTF-8"?>
<article id="2335"><body>Some kind of &lt;a
href="http://cos.com"&gt;HTML&lt;/a&gt;</body></article>

As you can see, all the HTML special chars where transformed to entities. How
can I prevent that happening?

As a side note: I'm pretty new here, so if it's really frequently asked
question, please don't be mad and direct me to the solution instead (I have
browsed the threads up to may, though).  Thanks in advance.

-- 
Martel Valgoerad  (a.k.a. Michal Minicki) | "You don't stop laughing because
alea.iacta.est | Martel -> [email protected] | you grow old. You grow old because
Web Page:               http://www.aie.pl | you stop laughing." M. Pritchard