mardi 28 avril 2015

How do you display XML code in HTML [duplicate]

This question already has an answer here:

What I'm trying to figure out is how to display XML snippets on a webpage using HTML. However the things I've tried have resulted in my XML tags to disappear but the text remains.

<pre> <code class="codeblock"><![CDATA[
   <dependency>
     <groupId>com.foo.bar</groupId>
     <artifactId>bar</artifactId>
     <version>LATEST</version>
   </dependency>
]]></code></pre>

The above results in the below to be displayed

com.foo.bar
bar
LATEST

the desired output would be

<dependency>
  <groupId>com.foo.bar</groupId>
  <artifactId>bar</artifactId>
  <version>LATEST</version>
</dependency>




Aucun commentaire:

Enregistrer un commentaire