Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using xml formatter and returning xml from WEB API. Web API removed NULL columns from the output. In json formatter we can have below code to include NULL values in output.

<pre lang="c#">
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = NullValueHandling.Include;

But there is no equivalent properties in XmlFormatter. I've tried searching but not been able to find a solution so far.

Please help. Thanks.

What I have tried:

I tried finding similar properties for XmlFormatter as that of JsonFormatter but could not find it.
Posted
Updated 27-Apr-16 21:54pm
v2
Comments
Sergey Alexandrovich Kryukov 28-Apr-16 12:36pm    
For XML, null should already be allowed, without any property to allow or prohibit that.
—SA
Member 3482939 29-Apr-16 8:06am    
I am removing json formatter by below line in webapi.config.

<pre>config.Formatters.Remove(config.Formatters.JsonFormatter );</pre>

I am getting xml back from the API by converting dataset to xml. But I do not get the columns having null value on the client side.

Please suggest.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900