1

我在pre标签内输出一些 C++ 时遇到问题。

我拥有的 XHTML 代码是:

<!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>

但是当我尝试查看网页时,我只看到

int x = 1;
]]>

并不是

#include <cstdio> 

int x = 1;

如我所愿。

CDATA我对行为有什么不明白的地方?

4

1 回答 1

1

CDATA 不是 HTML 结构;它是一个 XML(和 XHTML)结构。

于 2011-08-23T13:15:57.280 回答