开发者

CDATA not working for C++ code inside a <pre> tag

I have a problem with outputting some C++ inside a pre tag.

The XHTML code I have is :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
   <head>   
      <meta http-equiv="Content-Type" content="application/xhtml+xml" />
   </head>
   <body>
   <pre><![CDATA[
   #include <cstdio> 

   int x = 1;
   ]]></pre>
   </body>
</html>

But when I try to view the webpage I only see

int x = 1;
]]>

and not

#include <cstdio> 

int x = 1;

as I want to.

What开发者_如何学编程 don't I understand about CDATA behaviour ?


CDATA is not an HTML construct; it is an XML (and XHTML) construct.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜