dmay
dmay

Reputation: 1315

Show xml content in div

I am getting json response from server through ajax call. One parameter in json contain xml. But when i set the content of that parameter to div it is not showing xml data. How can i show the xml content in div and if possible formatted xml data.

Upvotes: 0

Views: 2722

Answers (1)

ComFreek
ComFreek

Reputation: 29424

  • Don't set the XML as the innerHTML. Create an inner text node, e.g.

    elem.appendChild( document.createTextNode(yourXmlString) );
    
  • Google Code Prettify could help

Upvotes: 1

Related Questions