i need to serialize my class into xml that looks like this:
<dog>
<breed type="large">spaniel</breed>
</dog>
but i'm not sure how to get an attribute into a property of my class, i can
use the xmlattribute tag to make an attribute of my dog class but i want an
attribute on my property, is this possible? if so how do i do it?
many thanks
Giles Morris
Marvin Smit - 05 Aug 2005 16:41 GMT
Hi,
you should be able to do this. I've just tested this class and it
produces the output you where giving as an example. (with an
additional namespace)
[XmlRootAttribute(Namespace="http://www.marv-in.net/Examples/XMLandSuch",
sNullable=false)]
public class Dog
{
/// <remarks/>
public DogBreed breed;
}
/// <remarks/>
public class DogBreed
{
/// <remarks/>
[XmlTextAttribute]
public string Text;
/// <remarks/>
[XmlAttributeAttribute]
public string type;
}
Hope this helps,
Marvin Smit.
>i need to serialize my class into xml that looks like this:
>
[quoted text clipped - 9 lines]
>
>Giles Morris