views:

19

answers:

1

I'm writing a simple atom XML parser with PHP

I have trouble displaying the proper content inside the <content> tag if there is additional HTML tag within.

Ex. If I want to parse the following XML

 <entry> 
       <title>Test entry #3</title> 
       <id>http://example.org/article3&lt;/id&gt; 
       <updated>2006-10-03T13:14:34Z</updated> 
       <link href="http://example.org/article3" /> 
       <content type="xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"&gt; 
         <xhtml:div>This is also <xhtml:em>very</xhtml:em> exciting. &amp; <xhtml:img src="http://www.w3.org/y" alt=":-)" /></xhtml:div> 
       </content> 
     </entry> 

my code will not display anything inside the <content> tag. What method do I use to bypass and embed all the text side the <content> to display as proper HTML ?

Update: I used htmlspecialchars method to pass everything inside the $content but that doesn't seems to get the job done.

I guess I need to make this more clear, my goal is to pass those <xhtml:div> as markup so the browser will display it properly

+1  A: 
<![CDATA[<p>HTML goes here</p>]]!>
Phil Brown
doesn't really work in my case ... tho, thanks for the hint
Jonathan