【发布时间】:2012-06-09 19:52:56
【问题描述】:
我正在尝试在 html 页面上打印 xml。
例子:
<pre><code class="xml">
<?xml version="1.0"?>
<response value="ok" xml:lang="en">
<text>Ok</text>
<comment html_allowed="true"/>
<ns1:description><![CDATA[
CDATA does <not> escape <tags like="this"></tags></not>.
]]></ns1:description>
<a></a> <a/>
</response>
</code></pre>
我想使用highlight.js 突出显示页面上的代码,但与 xml 和 html 存在冲突。
我只在一些使用<pre><code class="php"></code></pre> 的php 代码上取得了成功,还没有尝试过使用其他语言。我发现显示 xml 代码的唯一方法是在 textarea 中,但我更喜欢用一些甜美的语法高亮显示 xml。
我已经发了jsfiddle to illustrate the problem。
希望你能帮忙。
【问题讨论】:
标签: javascript html xml syntax-highlighting