XmlElement updateRecipient = doc.CreateElement('UpdateRecipient'); XmlElement email = doc.CreateElement('EMAIL'); XmlElement listID = doc.CreateElement('LIST_ID'); XmlElement column = doc.CreateElement('COLUMN'); XmlElement name = doc.CreateElement('NAME'); XmlElement value = doc.CreateElement('VALUE') root.AppendChild(body); body.AppendChild(updateRecipient); updateRecipient.AppendChild(listID); listID.InnerText = _listID; updateRecipient.AppendChild(email); email.InnerText = _email; updateRecipient.AppendChild(column); column.AppendChild(name); name.InnerText = _columnNameFrequency; column.AppendChild(value); value.InnerText = _actionID.ToString(); updateRecipient.AppendChild(column); column.AppendChild(name); name.InnerText = _columnNameStatus; column.AppendChild(value);
for some reason, I end up getting only one sub column instead of two under updateRecipient Element. I need both to show up under UpdateRecipient Node like this:
<UpdateRecipient> <LIST_ID>85628</LIST_ID> <EMAIL>somebody@domain.com</EMAIL> <COLUMN> <NAME>Frequency</NAME> <VALUE>1</VALUE> </COLUMN> <COLUMN> <NAME>Status</NAME> <VALUE>Opted In</VALUE> </COLUMN> </UpdateRecipient>
but so far I am getting only one :
<UpdateRecipient> <LIST_ID>85628</LIST_ID> <EMAIL>somebody@domain.com</EMAIL> <COLUMN> <NAME>Status</NAME> <VALUE>Opted In</VALUE> </COLUMN> </UpdateRecipient>
When it hits the first AppendChild(column) and then name and value, frequency shows find but then is later overrident by the Status and I want it to just append a new under and I’mnot sure why it’s overriding rather than adding another tag.
The problem is that you are reusing the ‘column’, ‘name’, & ‘value’ variables. You need to create new XmlElements for the 2nd set.