Hi,
I'm serializing C# objects, only I'm creating attribute-normal XML
instead of (the default) element-normal XML.
For each item that gets serialized, I'm programmatically applying an
XMLAttributeAttribute, to cause each XML Element to, instead, be
serialized as an XML Attribute.
The only problem comes in where non-numeric properties, with null
values, are concerned.
In the case of an unassigned number Property or Field, the output XML
has an attribute with value "0". This is fine with me.
In the case of an unassigned string, however, the output XML acts as if
that attribute does not exist at all. (This is no good since these
objects are going to a client-side deserializer -- and just because a
Property is null, doesn't mean it shouldn't be included in the schema.)
I don't have access to the source code of the classes, so I can't
dictate that the default value of a class should never be null, or
anything like that. I'd like to avoid using Reflection to change null
values to String.Empty, or anything like that -- since that opens up
several new cans of worms.
Are there any other attributes of the serializer that can be set, so
that for a null non-numeric attribute "MyField", something like
"MyField = ' ' " goes into the output XML?
Hope this makes sense -- and thanks for any thoughts!
rs