IXmlSerializable and XmlType attribute

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am sure this question must have been asked earlier, just dont seem to get my answer even after elaborate searching.
I have a class, lets say Class1 with complex types (e.g. DateTime?). To serialize this class to xml through XmlSerializer, I have implemented IXmlSerializable interface which seems to work well.
The only problem is when I serialize List<Class1>, the element for Class1 always has the name "Class1". I actually want it to be in camel casing, i.e. as "class1". Setting an XmlType on Class1 throws an exception when it implements IXmlSerializable.
I have tried all possible combinations of using XmlAttributeOverrides (including specifying an XmlElementAttribute for Item property of List<Class1>), but I just dont seem to get this to work.
Any help would be greatly appreciated. <hr class="sig I always think tomorrow will have more time than today. And every today seems to pass-by faster than yesterday.
<br/>
Rahul Singla | http://www.rahulsingla.com http://www.rahulsingla.com

View the full article
 
Back
Top