问题描述
如何从数据服务中缩进xml响应?
How can i indent the xml response from my data service?
我对wcf数据服务的所有请求都在xml中,但没有缩进.
All my request to the wcf data service are in xml wihout indent.
我正在使用OData3 WCF Data Service 5.0
.
在使用Odata WCF Dataservice 4之前,我所有的响应数据都使用缩进xml.
Before in Odata WCF Dataservice 4, all my response data was in indent xml.
推荐答案
似乎由于WCF数据服务4.0是使用OData 3.0在WCF数据服务5.0中更新的,因此所有xml响应都不是我想要的,我通过实现IDispatchMessageInspector来解决了这个问题界面并通过xdocument和xmlTextwriter修改当前内容.
It seems that since wcf dataservice 4.0 was update in WCF Data Services 5.0 with OData 3.0, all the xml response is not intent, i solved this by implement the IDispatchMessageInspector interface and modify the current content by xdocument and xmlTextwriter .
这篇关于WCF DataService缩进xml响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!