Вот что я получаю:
<Recipients>
<recipients>
<mid_name />
<last_name>Community</last_name>
<company>co, inc.</company>
<user_id>871</user_id>
<email>community@co.com</email>
</recipients>
</Recipients>
Так и должно быть.
<recipients>
<recipient>
<mid_name />
<last_name>Community</last_name>
<company>co, inc.</company>
<user_id>871</user_id>
<email>community@co.com</email>
</recipient>
</recipients>
Вот так выглядит моя модель данных:
type recipient(userId:int, first:string, last:string, email: string, company: string) =
let mutable first = first
let mutable mid = "" ;
let mutable last = last
let mutable company = company
let mutable userId = userId
let mutable email = email
public new() =
new recipient(12180,"Joe","Plumber","Joe@plumber.com","tubes tied, inc")
[<XmlElement("first_name")>]
member this.First with get() = first and set v = first <- v
[<XmlElement("mid_name")>]
member this.Mid with get() = mid and set v = mid <- v
[<XmlElement("last_name")>]
member this.Last with get() = last and set v = last <- v
[<XmlElement("company")>]
member this.Company with get() = company and set v = company <- v
[<XmlElement("user_id")>]
member this.UserId with get() = userId and set v = userId <- v
[<XmlElement("email")>]
member this.Email with get() = email and set v = email <- v
А это:
type record( id:int, sr:sender, recipients: recipient array, atts : attachment array, con : conversation, madeDate : creation) =
let mutable id: int = id
let mutable typ = "Idea"
let mutable creation = madeDate
let mutable sender = sr
let mutable recipients = recipients
let mutable conversation = con
let mutable attachments = atts
public new() =
record( -1, sender(-1,"Joe","Plumber","Joe@plumber.com"), Array.empty, Array.empty, conversation(), creation())
[<XmlAttributeAttribute("type")>]
member this.Type with get() = typ and set v = typ <- v
[<XmlAttributeAttribute("id")>]
member this.Id with get() = id and set v = id <- v
[<XmlElement("creation_date")>]
member this.Creation with get() = creation and set v = creation <- v
[<XmlElement("interaction_id")>]
member this.InteractionId with get() = id and set v = id <- v
[<XmlElement("sender")>]
member this.Sender with get() = sender and set v = sender <- v
//[<XmlArrayAttribute("recipients")>]
[<XmlArrayItem(typeof<recipient>, ElementName = "recipients")>]
member this.Recipients with get() = recipients and set v = recipients <- v
[<XmlElement("conversation_info")>]
member this.Conversation with get() = conversation and set v = conversation <- v
[<XmlArrayAttribute("attachments")>]
[<XmlArrayItem(typeof<attachment>, ElementName = "attachment")>]
member this.Attachments with get() = attachments and set v = attachments <- v
Как я могу изменить свою модель данных, чтобы самый внешний тег менялся с «Получатели» на «получатели», а внутренний тег - с «получателей» на «получателя»?