G
Guest
Hi,
I have used the xsd tool to generate a class from a schema. I then
use the XmlSerializer class to write an object to an XML file. So far
so good.
However attributes that are set to their default values are not
serialized to the XML file. However I would like to force the
serializer to write an attribute to the file, even if it is set to its
default value.
I have experimented with using a custom XmlTextWriter and also by
using XmlAttributeOverrides, but I can't figure out how to achieve
this.
Has anyone done this? Could you post some sample code?
TIA, M.
I have used the xsd tool to generate a class from a schema. I then
use the XmlSerializer class to write an object to an XML file. So far
so good.
However attributes that are set to their default values are not
serialized to the XML file. However I would like to force the
serializer to write an attribute to the file, even if it is set to its
default value.
I have experimented with using a custom XmlTextWriter and also by
using XmlAttributeOverrides, but I can't figure out how to achieve
this.
Has anyone done this? Could you post some sample code?
TIA, M.