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:
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 <COLUMN> under <UpdateRecipient> and I'mnot sure why it's overriding rather than adding another
<COLUMN> tag.
as far as I can see so why do you expect there to be two 'COLUMN' elements? You need to create a second 'COLUMN' element and of course also further child elements like 'NAME' or 'VALUE' if you want to insert a second such element.
Martin Honnen --- MVP Data Platform Development
My blog
espresso
Member
80 Points
387 Posts
XmlReader Append Column overriding previous rather than appending new
Mar 18, 2009 04:12 PM|LINK
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 <COLUMN>:
<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 <COLUMN> under <UpdateRecipient> and I'mnot sure why it's overriding rather than adding another <COLUMN> tag.
Martin_Honne...
Star
14481 Points
2006 Posts
MVP
Re: XmlReader Append Column overriding previous rather than appending new
Mar 18, 2009 04:54 PM|LINK
Well your code has only one
XmlElement column = doc.CreateElement("COLUMN");
as far as I can see so why do you expect there to be two 'COLUMN' elements? You need to create a second 'COLUMN' element and of course also further child elements like 'NAME' or 'VALUE' if you want to insert a second such element.
My blog