为什么 XML 文件无法在 Firefox 中正确呈现?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10649253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why XML file is not rendered properly in Firefox?
提问by Vivek S
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:
我正在使用 Firefox 读取 XML 文件,但它没有正确呈现 XML 文件。可能是什么问题呢?我在下面发布了 XML 示例:
<?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:
我的 Firefox 显示为:
uspwd1010T20120518091833
I am expecting this:
我期待这个:
<ExtPostTransaction>
<TransactionInfo>
<UserID>us</UserID>
<Password>pwd</Password>
<ServiceCode>1010</ServiceCode>
<TransactionID>T20120518091833</TransactionID>
</TransactionInfo>
</ExtPostTransaction>
采纳答案by Vivek S
Finally found the solution.When firebug is on it seems firefox renders the XML file wrongly.When it is off, XML files are rendered properly.
终于找到了解决方案。firebug打开时,firefox似乎错误地呈现了XML文件。当它关闭时,XML文件可以正确呈现。
回答by Anand saga
for me, It turns out that some sort of Skype add-on was the problem. Great detective work. It's odd how that click-to-call extension creates such random issues...
对我来说,结果是某种 Skype 附加组件是问题所在。伟大的侦探工作。奇怪的是,点击通话扩展程序如何产生如此随机的问题......
just disable skype click-to-call add-on, after that Firefox showing row xml
在 Firefox 显示行 xml 之后,只需禁用 Skype click-to-call 附加组件
回答by Aaqib Khan
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.
在我的情况下,XML 页面显示为空白,当我查看页面源代码(当您右键单击页面或按Ctrl+时可用的选项U),完整的 XML 就在那里。
It was solved when I disabled Awesome Screenshotadd-on.
当我禁用Awesome Screenshot插件时,它解决了。
I suggest that you try deactivating add-ons one-by-one!
我建议您尝试一一停用附加组件!
回答by Paulo Capelo
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.
我遇到了同样的问题,我发现 Evernote webclipper 插件搞砸了我的 Firefox。一旦我禁用它,我就能够查看预先格式化的 xml。
回答by AlphaCactus
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.
尝试禁用所有 Firefox 扩展,然后重新加载 XML 并查看 XML 是否再次显示为树。如果是这样,请一一重新启用它们,直到您的 xml 失去样式为止。
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).
对我来说,它是Adobe Acrobat 18.0.8 "Convert current web page to an Adobe PDF file"Firefox Quantum 59.0.2(64 位)中的插件。
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.
禁用后,刷新页面会生成好看的 XML 树。启用该插件会立即将 XML 恢复为没有标签的纯文本,无需刷新。
回答by Bonana
For me, it comes from AdBlocker Ultimate(in version 2.26 at least)
对我来说,它来自AdBlocker Ultimate(至少在 2.26 版中)
But apparently there's a long list of plugins that modify that including (in some versions at least): - Skype call on click - Avira - Kaspersky
但显然有一长串插件可以修改,包括(至少在某些版本中): - Skype 通话点击 - Avira - 卡巴斯基
And yes the problem occurs with content served with Content-Type: application/xml
是的,问题出现在提供的内容上 Content-Type: application/xml
回答by Quentin
It sounds like you are serving the document with a text/htmlcontent-type, so Firefox is trying to render it as HTML.
听起来您正在为具有text/html内容类型的文档提供服务,因此 Firefox 试图将其呈现为 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/xmlor other XML content-type.
如果您希望它使用其默认的 XML 视图来呈现它,您需要真实地说明它是什么类型的数据。使用application/xml或其他 XML 内容类型为其提供服务。
The specifics of how you do that will depend on your webserver and/or server side programming language (if one is involved).
您如何做到这一点的细节将取决于您的网络服务器和/或服务器端编程语言(如果涉及)。
回答by user674669
I had to disable Firefox extension 'AdBlocker Lite 0.4.2' to get XML files to show as XML not text.
我必须禁用 Firefox 扩展“AdBlocker Lite 0.4.2”才能让 XML 文件显示为 XML 而不是文本。
回答by Martin Cup
I had to disable 'LanguageTool - Grammar and Style Checker'.
我不得不禁用“语言工具 - 语法和样式检查器”。
回答by tshalif
Disabling the 'Selenium IDE' extension (https://github.com/SeleniumHQ/selenium-ide) fixed the problem for me.
禁用“Selenium IDE”扩展(https://github.com/SeleniumHQ/selenium-ide)为我解决了这个问题。

