Click to See Complete Forum and Search --> : XML Serialization Help


homiesite
07-08-2008, 03:28 PM
Hi Everyone,

I am hoping someone can help me. I am recieving XML info from a server using XML Serialization. I have to use an array to retieve the multiple tags. I am able to retieve the tags but I can't seem to retrieve the attributes.

Here is the XML I get from the server.....

<EmailAddressList>
<EmailAddress Type="Business">someone@website.com</EmailAddress>
<EmailAddress Type="Personal">somebody@website.com</EmailAddress>
</EmailAddressList>

Here is my code.....

private string[] emails;

[XmlArray(ElementName="EmailAddressList")]
[XmlArrayItem(ElementName="EmailAddress")]
public string[ ] Emails
{
get
{
return emails;
}
set
{
emails = value;
}
}

From this code, I can retrieve the multiple EmailAddress tags, but I can't retrive the "Type" attribute. No matter what I've tried, I can't get retrieve the attribute. Can someone help me? I would realluy appreciate it! Thanks!