1
Answer

Rearrange and update the id of xml in linq

Anurag Malani

Anurag Malani

10y
862
1
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 - 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Match>
<Matchdetail Id="1">Bla..Bla..Bla</Matchdetail>
 <Elements>
 <Element Sequence="8"> Bla..Blaa..Bla..</Element>
<Element Sequence="2"> Bla..Blaa..Bla..</Element>
<Element Sequence="3"> Bla..Blaa..Bla..</Element>
<Element Sequence="6"> Bla..Blaa..Bla..</Element>
<Element Sequence="10"> Bla..Blaa..Bla..</Element> 
</Elements> 
</ Match>
 
Now i want to update the Sequence in uniform order. so what i want is look like this - 
 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Match>
<Matchdetail Id="1">Bla..Bla..Bla</Matchdetail>
<Elements>
<Element Sequence="1"> Bla..Blaa..Bla..</Element>
<Element Sequence="2"> Bla..Blaa..Bla..</Element>
<Element Sequence="3"> Bla..Blaa..Bla..</Element>
<Element Sequence="4"> Bla..Blaa..Bla..</Element>
<Element Sequence="5"> Bla..Blaa..Bla..</Element>
</Elements>
</ Match>
 
 

Answers (1)