XML mapping using google-code-prettify

I can't seem to get Google prettify to work with basic XML: someone got it working or can see what I'm doing wrong: here is my code:

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

Any help would be greatly appreciated.

+5
source share
2 answers

The root cause is the HTML tag.

Change <to &lt;

Change> to &gt;

+8
source

First you need html to encode an example xml code. You can use one of the available online tools for this. Then just wrap it in pre / code

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

and attach the js code on the site.

+4
source

Source: https://habr.com/ru/post/1205874/


All Articles