Hi,
I have the following contents in my XML file:
<items>
<item id="1"><content><![CDATA[<p>string</p>]]></content></item>
</items>
I have HTML inside the content, so, I used CDATA. However, when I'm trying to display the content as HTML on the web page:
$item_content = $xpath2->query("/bulletin/item[@id='$item_id']/content");
foreach ($item_content as $i)
{
$a = $dom->createElement('div');
$a->appendChild($dom->createCDATASection($i->nodeValue));
// $child = $dom->createElement('div',$i->nodeValue); <--this fails miserably
$content_tag->appendChild($a);
}
It will get displayed as:
< ;p> ;string< ;/p> ;
How do I display it as HTML?