How to get Firefox to show text/xml as plain text?

6,262

Solution 1

The View Source command will do exactly what you want.

It can be found from the right click context menu inside of Firefox (image found from Google search):

View Page Source

Solution 2

I'm on Ubuntu with Firefox 3.6.10 and xml files appear properly formatted (tagged, highlighted and indented). Sounds like your mime-type properties aren't being recognized properly (ie not Firefox's fault).

Solution 3

Using Firefox 70 on Windows, normal XML display is a tree with highlighted tags.

Sometimes, adding some plugins can make this behaviour to change, displaying the XML as HTML instead, this is hiding tags and displaying only content, if any.

  • In this case a workaround is to View Source oh the XML, which will always show plain text content, but also with highlighted tags.
  • Another workaround is using a different browser, like Chrome, Opera, etc.
  • Some people say this behaviour is because of XML content, but since it worked before with the same content, clearly it's something that changed in Firefox. You can try disabling plugins temporary until identify the evil one.

Solution 4

Any way to get it to display useful content? It would be amazing if it would have highlighting etc., but just displaying it as plain text should be good enough.

Without a test case I can't duplicate this behaviour. It shows a parse-tree by default in the test case I set up.

There couldn't possibly be any use in current behaviour of stripping all tags and displaying non-tag text as one big block.

There's would be plenty of justification. text/xml is a valid format for things that Fx can render - not simply deliver. So, as a result, it renders them - it doesn't treat them as text. In fact, by stating the document is text/xml, you are explicitly telling Fx NOT to treat them as plain text.

Share:
6,262

Related videos on Youtube

taw
Author by

taw

Ruby/Perl/Python/* freelancer from London. Writes a blog and codes some Open Source stuff in free time.

Updated on September 17, 2022

Comments

  • taw
    taw over 1 year

    There couldn't possibly be any use in current behaviour of stripping all tags and displaying non-tag text as one big block.

    Any way to get it to display useful content? It would be amazing if it would have highlighting etc., but just displaying it as plain text should be good enough.

    • roblogic
      roblogic about 7 years
      Use "View source", i.e. Ctrl + U.
    • Marcello Nuccio
      Marcello Nuccio almost 6 years
      You should try to disable firefox extensions. Look at: stackoverflow.com/q/10649253/453605
  • taw
    taw over 13 years
    Unless xml has associated stylesheet, or some mime type more generic than text/xml or application/xml, how can it be formatted? I found that I can use Force Content-Type extension to map all application/xml to text/plain on certain url regexp - it's an adequate workaround.
  • Rushyo
    Rushyo over 13 years
    However Fx wants to handle it. A text file can be turned into an image or maybe even 3D shaders if the renderer wants, it doesn't make it any less correct to ajudge it as also being text/plain. Consider MathML or even SVG. Mime-types are semantics, they can be ignored. A document might have a million different ways of being displayed depending on its contents but only one mime-type.
  • Rushyo
    Rushyo over 9 years
    I think it's curious you pull me up for apparently not answering the question (it is implied my answer is 'no, and here's why:') but don't mind the fact the question is actually dependent on subjective interpretation as to what is 'useful', making an objective answer presumptuous from the start (hence why I didn't explicitly state 'no' and left it to be implied). Cannae win either way.
  • roblogic
    roblogic about 7 years
    Nice simple solution. Shortcut is Ctrl + U