gpt4 book ai didi

xml - 强制 Firefox 以树状方式呈现 XML

转载 作者:行者123 更新时间:2023-12-04 06:48:09 25 4
gpt4 key购买 nike

我试图让 Firefox 以树状格式呈现返回给它的 XML,就像在 Internet Explorer 中一样。

目前它只显示字段值.. 即没有 XML

我是否缺少某些特殊设置?

编辑

这是正在返回的xml

<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>

但它显示以下内容
1Hello

编辑

这是通过 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>

编辑

现在我有了这个......但仍然是同样的问题..看看内容类型
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>

最佳答案

这是因为 Firefox 试图将文件呈现为 HTML,正如 Content-Type: text/html 所告知的那样。标题。并且 HTML 浏览器应该忽略未知标签。

您希望您的服务器返回 Content-Type: application/xml .我不知道如何配置 IIS 来执行此操作,但最简单的方法可能是使用 .xml 命名文件。扩展名,如果你还没有。

关于xml - 强制 Firefox 以树状方式呈现 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3496605/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com