I have a class with a collection of other classes that gets serialized.
The collection of classes is defined as such in my SubSonic partial class:
public partial class TblReceipt
{
// no need to override any existing methods or properties as we
// are simply adding
// specifying the types of objects to be contained within the arraylist
[XmlElement(Type = typeof(TblReceiptLineItem), ElementName="ReceiptItem")]
public ArrayList ReceiptLineItemsArr = new ArrayList();
public string ReceiptLineItemsXml;
public string UserPhoneNumber;
public string UserCardNumber;
}
When the class is serialized the collection items properly display with ReceiptItem, however the first bit of the XML is showing the table name - TblReceipt.
I attempted to change this by first declaring the table as such:
[XmlArrayAttribute("Receipt")]
TblReceipt receipt;
However that does no good.
I'm thinking it needs to be done somewhere around here:
XmlSerializer serializer = new XmlSerializer(typeof(TblReceipt));
serializer.Serialize(output, receipt);
ret = output.ToString();
But not quite sure where.... maybe because it's late I'm missing the obvious. A second pair of eyes would help.
Thanks.