【问题标题】:Displaying XML using google-code-prettify使用 google-code-prettify 显示 XML
【发布时间】:2014-10-30 14:59:33
【问题描述】:

我似乎无法让 google prettify 使用基本 XML:任何人都可以使用它,或者可以看到我做错了什么:这是我的代码:

<html>
<head>
<meta charset="utf-8" />

<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?autoload=true&amp;skin=sunburst&amp;lang=xml"></script>

</head>

<body>
<h1>XML Output</h1>

<pre class="prettyprint" id="quine" style="border:4px solid #88c">

<Rest_appt_pull licenseKey="123" passWord="456" start="30-oct-2014 00:00:00" finish="31-oct-2014 23:59:59" p_method="event">
<timings>
<entry label="Read" 
time=".03" 
segment=".03" />
<entry label="Processing XML" 
time=".04" 
segment=".01" />
</timings>
</Rest_appt_pull>

</pre>

</body>
</html>

任何帮助将不胜感激

【问题讨论】:

  • 你最终用什么来编码 xml?

标签: prettify google-code-prettify


【解决方案1】:

根本原因是html标签符号。

将&lt;

更改 > 为 &amp;gt;

【讨论】:

    【解决方案2】:

    您需要先对您的 xml 代码示例进行 html 编码。您可以使用其中一种可用的在线工具来执行此操作。然后将其包装在 pre/code 中

    <pre class="prettyprint lang-xml"> ... your html encoded xml code ... </pre>
    

    并在网站上附上js代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多