Trying to serialize an object through xmlSerializer

Topics: Questions
Jun 22, 2012 at 10:44 AM

Hi Geert

We're trying to store an object as Xml.
Instead of manually creating the xml, we are using the xmlSerializer.

I've been experiencing issues when trying to get this to work.
We are applying attributes to our properties, but hey seem to have no effect.

In this case, our object has 3 properties: 2 string and one list of objects.

The list of object is automatically processed by the serializer, allthough I cannot give it a custom attributename. Furthermore, the 2 string properties aren't serialized at all, not as element and not as attribute as I tried to tell them.

When I removed the modelbase and made this object catel-free, the attributes (XmlAttributeAttribute,...) had effect and the xml created was what I expected.

Do you have any idea if catel blocks any attribute declarations?
I've searched the documentation but couldn't find anything on custom xmlSerializing.

Thanks in advance.

Jun 24, 2012 at 12:43 PM

The DataObjectBase implements its own custom xml serializer. However, it should respect the xml attributes. Can you provide an example class so I can test it?

Jun 25, 2012 at 10:38 AM
Edited Jun 25, 2012 at 10:38 AM

Hey Geert

I've reproduced it in this little app: 

Repro application

The only XML attributes that seem to work are XmlIgnore and XmlRoot.

Jun 25, 2012 at 4:32 PM

Ok, this change is too large to include in 3.2. We will schedule this for 3.3.

Jun 25, 2012 at 4:34 PM