39

I am using Firefox to read XML files, but it is not rendering the XML file properly. What could be the problem? I’m posting the XML sample below:

<?xml version="1.0" encoding="utf-8"?>
<ExtPostTransaction>
    <TransactionInfo>
        <UserID>us</UserID>
        <Password>pwd</Password>
        <ServiceCode>1010</ServiceCode>
        <TransactionID>T20120518091833</TransactionID>
    </TransactionInfo>
</ExtPostTransaction>

My Firefox shows it as:

uspwd1010T20120518091833

I am expecting this:

<ExtPostTransaction>
  <TransactionInfo>
    <UserID>us</UserID>
    <Password>pwd</Password>
    <ServiceCode>1010</ServiceCode>
    <TransactionID>T20120518091833</TransactionID>
  </TransactionInfo>
</ExtPostTransaction>
0

14 Answers 14

28

Many add-ons cause this problem. Try disabling your add-ons; if it works, you know one of them was causing the issue for you. You can then re-enable them one-by-one to isolate the one causing the problem.

0
11

In my case, XML page was displaying blank and when I View Page Source (option available when you right click on the page or by pressing Ctrl+U), the complete XML is there.

It was solved when I disabled Awesome Screenshot add-on.

I suggest that you try deactivating add-ons one-by-one!

0
10

For me, it comes from AdBlocker Ultimate (in version 2.26 at least)

But apparently there's a long list of plugins that modify that including (in some versions at least): - Skype call on click - Avira - Kaspersky

And yes the problem occurs with content served with Content-Type: application/xml

1
  • My issue was from localhost, so I just disabled it for that 'site'. Apr 12, 2021 at 18:03
5

I had the same issue and I found out that the Evernote webclipper add-on was messing up my firefox. Once I disable it I was able to view a pre-formated xml.

0
5

Try disabling all Firefox extensions, then reload the XML and see if the XML is once again displayed as a tree. If so, re-enable them one by one until your xml loses its styling.

For me it was the the Adobe Acrobat 18.0.8 "Convert current web page to an Adobe PDF file" addon in Firefox Quantum 59.0.2 (64-bit).

Once disabled, refreshing the page made resulted in good looking XML tree. Enabling that addon would revert the XML to plain text without tags immediately without a refresh.

0
3

Finally found the solution for me. When Firebug is enabled it seems Firefox renders the XML file wrongly. When it is off, XML files are rendered properly.

0
3

In my case Tampermonkey (currently 4.18.1) for Firefox was the issue.

2

It sounds like you are serving the document with a text/html content-type, so Firefox is trying to render it as HTML.

If you want it to render it using its default XML view, you need to be truthful about what sort of data it is. Serve it with an application/xml or other XML content-type.

The specifics of how you do that will depend on your webserver and/or server side programming language (if one is involved).

7
  • I get those xml files via mail.How can i set the content type to it?
    – Vivek S
    May 18, 2012 at 8:36
  • 1
    Is your question "Someone sent me an XML file by email, and when I double click it, it opens in Firefox as if it were HTML"? If so, ask on Superuser, it isn't a programming problem.
    – Quentin
    May 18, 2012 at 8:37
  • NO my code genrates xml files and sends it via email.I am in testing pahse of the module.
    – Vivek S
    May 18, 2012 at 8:39
  • I even tried it via code setting the content type...still it displays the same result.
    – Vivek S
    May 18, 2012 at 8:42
  • 1
    I downloaded and saved it as .xml file and then opend it via firefox.
    – Vivek S
    May 18, 2012 at 8:46
1

I had a very similar problem, but I had no add-ons to disable. Then I noticed some graphical images within the text. They turned out to be embedded SVG. When I stripped these out, the remaining XML markup was rendered as a expandable tree as expected.

Apparently the Firefox renderer sees the SVG and transforms it first, not recognizing it as simply part of an XML document. I notice also that Chrome handles this the same way.

1

There appear to be a number of extensions that modify the display of the page in such a way as to break the rendering of XML.

The best way to check if the issue is caused by an addon is to try and view the page in a private window. If it displays correctly, disable your addons one by one until you find the offender. Then, please add it to the list.

Some of the known addons from other posts are:

  • Nimbus Screen Capture: Screenshots, Annotate
  • Selenium IDE
  • LanguageTool - Grammar and Style Checker
  • Kaspersky Protection
  • Avira browser Safety
  • AdBlocker Lite
  • AdBlocker Ultimate
  • Skype click to call
  • Adobe Acrobat
  • Awesome Screenshot
  • Youtube download
  • Katalon Recorder
  • WhatFont
  • Honey
1
  • For me it was Awesome Screenshot.
    – kanenas
    Oct 23, 2023 at 12:49
1

I don't know which add-on I had that cause the problem, but I don't have any addon that I want to disable or remove.

I have instead installed https://addons.mozilla.org/en-US/firefox/addon/pretty-xml/ and it's beautiful

1

Disabling the Selenium IDE extension (https://github.com/SeleniumHQ/selenium-ide) fixed the problem for me.

0

I opened a private tab, and everything was fine. Then I turned off and on extensions one by one until xml file was rendered properly.

For me DuckDuckGo Privacy Essentials was the problem.

0

I had to disable Firefox extension AdBlocker Lite 0.4.2 to get XML files to show as XML not text.

Not the answer you're looking for? Browse other questions tagged or ask your own question.