mark smith
mark smith

Reputation: 20907

Forcing Firefox to render XML in a tree like fashion

I am trying to get Firefox to render the XML that is being returned to it in a tree like format as in Internet explorer.

Currently it just displays the field values .. i.e. NO XML

Is there some special setting am I missing?

EDIT

Here is the xml that is being returned

<ArrayOfSampleItem xmlns="http://schemas.datacontract.org/2004/07/InmoCasaService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><SampleItem><Id>1</Id><StringValue>Hello</StringValue></SampleItem></ArrayOfSampleItem>

but it displays the following

1Hello

EDIT

And here is what is returned via fiddler

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 222
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 16 Aug 2010 19:56:27 GMT

<ArrayOfSampleItem xmlns="http://schemas.datacontract.org/2004/07/InmoCasaService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><SampleItem><Id>1</Id><StringValue>Hello</StringValue></SampleItem></ArrayOfSampleItem>

EDIT

Now i have this... but still the same problem.. Look at the content type

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 226
Content-Type: application/xml
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 17 Aug 2010 06:09:14 GMT

<ArrayOfSampleItem xmlns="http://schemas.datacontract.org/2004/07/InmoCasaService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><SampleItem><Id>1</Id><StringValue>He4444llo</StringValue></SampleItem></ArrayOfSampleItem>

Upvotes: 2

Views: 3832

Answers (4)

RickS
RickS

Reputation: 1111

Well, here is part of the magic that may help:

In your javascript, let's say you have a string of XML -- no matter how it got there -- like this:

var myXMLDoc = "<?xml version='1.0' ?><snarg><floof>42</floof></snarg>";

If you jam this into the current document, (or a new window), as is like this:

document.write (myXMLDoc);

Then browser will treat it as HTML, and you won't get the lovely XML tree diagram in Firefox.
But, if you preceed your document with magic that tells the browser how to interpret it:

document.write ("data:text/xml," + myXMLDoc);

Then you will kick Firefox into interpreting as XML and get the way cool tree diagram.

Upvotes: 1

annaken
annaken

Reputation: 383

I had the same problem, it turned out to be one of my plugins (Wappalyzer). Reading around, I think there are a few plugins that do this (Firebug included).

Disabling it and restarting Firefox fixed the problem.

Upvotes: 1

Benoit
Benoit

Reputation: 3598

Also it may not render in FF because you dont have xml full structure including header (not the http header, they seems fine) and encoding informations.

Upvotes: 0

svick
svick

Reputation: 244858

It's because Firefox is trying to render the file as HTML, as it is being told by the Content-Type: text/html header. And HTML browser should ignore unknown tags.

You want your server to return Content-Type: application/xml. I don't know how to configure IIS to do this, but the easiest way may be to name the file with the .xml extension, if you haven't already.

Upvotes: 1

Related Questions