Anurag Malani

Anurag Malani

  • NA
  • 80
  • 33.4k

Rearrange and update the id of xml in linq

Jul 23 2014 3:12 AM
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)