XML is parsed as HTML when called through iframe

I'm trying to show an xml file in a HTML page using iframe by bringing the content through jQuery by altering the source attribute.

When I open the iframe on my browser (Firefox/Chrome/IE8), it opens fine just as below:

But when the same document rendered using an iframe, the xml is being parsed as HTML and displayed as shown in the image below:

I have set proper headers and when I checked on the network tabs in the console, it is showing proper result:

I'm not able to figure out a proper way which will display the XML properly under the iframe. Tried various solutions posted on different forums but it does not seem to be working.

Thank you!


If raw content display is ok for you, then you have the following options.

Wrap things in the xmp or pre tag (there is also textarea) - maybe combined with jQuery escaping:

    <!-- the raw content - code, xml --> 

Need Your Help

Python 3 - Find two letters in same row

python string list grid

I'm having troubles with being able to find out if two letters are in the same row of my 4x4 grid. For example, if i have the list

.htaccess routing to subdirectory on server? performance/loading times

http .htaccess routing webserver

I wonder if it is possible to use an .htaccess file to rout my domain directly to a subdirectory on my server?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.