Reputation: 16282
if any property is blank or null then for that property xml tag is generated like </Attention>
but i want to generate it like <Attention></Attention>
. so implement IXmlSerializable interface and from the WriteXml() method i tried to change the xml tag when the value is null or empty but still not getting right output. so please tell me what i need to do to generate the xml tag like <Attention></Attention>
this if my Attention property is null or empty. basically i want customization of xml output. please guide me.
Upvotes: 1
Views: 107
Reputation: 26446
I had to implement this once because the server that was receiving my Xml would crash on such tags. I wouldn't go implement your own serialization code, but instead do some post-processing (Regex.Replace()
) after serialization, keeping the rest of your code clean.
Upvotes: 1