如何从 ADO.NET 数据服务返回纯 XML

发布于 2024-08-28 09:41:32 字数 291 浏览 5 评论 0原文

我想知道如何从 ADO.net 数据服务返回纯 XML

我已经向我们公司的不同技术部门公开了 ADO.net 数据服务。返回的数据是ATOM FEED,其格式有点难以阅读/解释,并且返回了太多信息。

来自不同部门的人员会执行不同的查询(HTTP 请求),我希望他们显示简单的 XML 或至少显示一些对用户更友好的内容,例如 HTML

我已尝试将请求的 ACCEPT 属性设置为简单的 XML 并且它仍然返回 ATOM

I was wondering how to return plain XML from ADO.net data services

I have exposed an ADO.net data service to different departments in our company who are not so technical. The data returned is ATOM FEED which is some-what hard to read / interpret with its format and too much information is returned.

People from various departments would execute different queries ( HTTP Request) and I would like them to display simple XML or at least something more user friendly like HTML

I have tried ACCEPT attribute of the request to be plain XML and it still returns ATOM

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬心 2024-09-04 09:41:32

如果我是你,我会使用友好提要,这是 WCF 数据服务的一项功能,它允许您将属性映射到提要字段,这些字段将在任何 rss 提要阅读器上显示为正确的 rss 提要,甚至是 IE 7 和 8 中的默认提要阅读器会显示它们并为您排序。

WCF 数据服务源自定义< /a>

希望这有帮助

If I were you I would use Friendly feeds which is a feature of WCF Data Services, which allows you to map properties to feed fields which would show as proper rss feeds on any rss feed reader, even the default feed reader from IE 7 and 8 would display them and sort them for you.

WCF Data Services Feed Customization

hope this helps

祁梦 2024-09-04 09:41:32

ADO.NET 数据服务 - 现在称为 WCF 数据服务 - 将始终返回 Atom feed - 这是它们功能的核心。

然而,在解释和使用该 Atom feed 时,您应该不会遇到任何麻烦。在客户端,您只需对服务 URL 执行添加服务引用,就会生成一个漂亮、干净的客户端代理,并包含可用于读取的 .NET 对象类并解释 WCF 数据服务的输出。您甚至可以针对此客户端类使用 LINQ 来执行查询!

我建议您了解并使用 Atom,而不是试图对抗它。

ADO.NET Data Services - now known as WCF Data Services - will always return an Atom feed - that's the core of their functioning.

You shouldn't have any trouble, however, interpreting and working with that Atom feed. On the client side, you can just do a Add Service Reference to the service URL, and a nice, clean client-side proxy will be generated, complete with .NET object classes which you can use to read and interpret the output from the WCF Data Service. You can even use LINQ against this client classes to do your queries!

I would recommend you get to know and use Atom, instead of trying to fight it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文