在linq中重新排列并更新xml的id [英] Rearrange and update the id of xml in linq

查看:83
本文介绍了在linq中重新排列并更新xml的id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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>

推荐答案

这篇关于在linq中重新排列并更新xml的id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆