According to your description, as far as I know, you could use remove method to remove the related elements. Then append a new element. Then append removed elements into new element. Please refer to this sample:
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
2 Points
1 Post
Add XML element to existing XmlNodeList C#?
Apr 04, 2017 03:53 AM|Narsa8|LINK
Hi,
I am getting strucked in below concept.
I have an xml string like this..
and desired output of XML string is
And I have tired until this part and could not find a solution how to add new element to existing XMLNodeList
How to add
<B></B>
element for whole<b></b>
elementsList?Please help me on this.
Thanks in advance
All-Star
31362 Points
7055 Posts
Re: Add XML element to existing XmlNodeList C#?
Apr 04, 2017 07:28 AM|kaushalparik27|LINK
Going thru XElement will be much easier than XmlDocument:
[KaushaL] Blog Twitter [MS MVP 2008 & 2009] [MCC 2011] [MVP Reconnect 2017]
Don't forget to click "Mark as Answer" on the post that helped you
Contributor
6730 Points
2715 Posts
Re: Add XML element to existing XmlNodeList C#?
Apr 04, 2017 08:09 AM|Eric Du|LINK
Hi Narsa8,
According to your description, as far as I know, you could use remove method to remove the related elements. Then append a new element. Then append removed elements into new element. Please refer to this sample:
Sample Code:
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.