-2

I have a very simple XML code. I want to show it in a div but properly styled. I tried run_prettify.js & use pre tag, but it is not showing raw xml, but parsing it.

Please help.

JSBIn link is jsbin

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
raju
  • 6,448
  • 24
  • 80
  • 163
  • "JSBIn link is jsbin" — Questions are required to include a [mcve] **in the question itself** – Quentin Mar 20 '18 at 11:06

1 Answers1

1

The issue is with the < > characters in your XML code.

There's no proper way of escaping those characters and displaying them as raw, in HTML. If your data is not too long, you might consider using &lt; and &gt; as here: JSBin example

Of course, you could even write (or find a library) some JS or PHP code that would filter that data, and replace < > characters.

Hope this helps!

eja
  • 4,677
  • 3
  • 21
  • 30