Manipulating the output of empty XML elements for .NET serialization
Posted on 2014-04-15
I need to find out how to manipulate the serialization of objects for empty elements. Specifically my requirement is to pass a <xmlnode></xmlnode> for empty nodes versus <xmlnode/>.
I am using the XML serializer to do this.
I tried setting my object as object.node = string.empty, but this only construct xml documents with nodes as <node/>.
The other technique i tried was setting a blank space like object.node = " ", but this also is being constructed as <node/>.
Any ideas how I can force a "full" xml element that is empty?