开发者

parsing XML with PHP need to display the embedded HTML as markup

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 en开发者_运维技巧try #3</title> 
       <id>http://example.org/article3</id> 
       <updated>2006-10-03T13:14:34Z</updated> 
       <link href="http://example.org/article3" /> 
       <content type="xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"> 
         <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


<![CDATA[<p>HTML goes here</p>]]!>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜