I have a xml which conatins the basic match data now I need to reorder it and update the id's of that node.
Here is my xml -
Match>
Now i want to update the Sequence in uniform order. so what i want is look like this -
Match>
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 23, 2014, 12:11 AM EDT
hi,
try following code
var xml = XElement.Load("XMLFile1.xml");
var ordered = from r in xml.Descendants("Element")
select r;
int seqNo = 1;
foreach (var p in ordered)
{
p.Attribute("Sequence").Value = seqNo.ToString();
seqNo += 1;
}
xml.Save("XMLFile2.xml");
hope this will help you.