如何返回包装在cdata中的字符串?

时间:2022-12-02 16:04:25

I have a wcf service that returns a Type instance. Say MyObject. MyObject has a string property (say CDataString)that i want wcf to wrap in a cdata section (because I'm returning an html fragment in a string property). How the heck do i annotate MyObject.CDataString so that when WCF puts it on the wire its wrapped in a cdata section?

我有一个返回类型实例的wcf服务。MyObject说。MyObject有一个字符串属性(比如CDataString),我希望wcf包装在cdata部分(因为我在string属性中返回一个html片段)。我怎么注释mytate对象。CDataString,这样当WCF把它放在电线上的时候它就被包裹在cdata区域中?

Thanks, Chris

谢谢你,克里斯

1 个解决方案

#1


4  

Sending XML in string CDataString property should not create any issue, WCF is able to handle it, did you try sending XML over WCF in string property?, if you are facing error could you please post here.

在string CDataString属性中发送XML应该不会产生任何问题,WCF能够处理它,您尝试在string属性中通过WCF发送XML吗?,如有错误,请在此张贴。

#1


4  

Sending XML in string CDataString property should not create any issue, WCF is able to handle it, did you try sending XML over WCF in string property?, if you are facing error could you please post here.

在string CDataString属性中发送XML应该不会产生任何问题,WCF能够处理它,您尝试在string属性中通过WCF发送XML吗?,如有错误,请在此张贴。