开发者

Remove suffix: from properties and xmlns: from root

开发者 https://www.devze.com 2023-02-07 10:02 出处:网络
I just want a plain xml as below Blockquote <error> <message>Attempted to divide by zero.</message>

I just want a plain xml as below

Blockquote

<error>
<message>Attempted to divide by zero.</message>
<status>500</status>

</error>

but i am getting some thing as below

<error xmlns:a="http://schemas.datacontract.org/2004/07/mynamespace.Service.Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:message>Attempted to divide by zero.</a:message>
<a:status>500</a:status>
</error>

what can i do to remove xmlns: and a:

my development is like http://social.msdn.micro开发者_JAVA技巧soft.com/Forums/en-US/wcf/thread/97ddb118-fdfd-4651-9e61-4d822861325f

protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
    this.serializer.WriteObject(writer, this.faultDetails);
 }


You need to write custom serializer. I wonder why you want to do it. Rather writing custom serializer, use regex on client side to remove the string.

0

精彩评论

暂无评论...
验证码 换一张
取 消