我想從MatchOdds節點中刪除所有重複的Bet元素,除了最後一個來自以下xml示例並將該文件保存在另一個目標中。Xdocument - 刪除除最後一個以外的重複元素c#
<Sports>
<Sport id="5" name="Tennis">
<Tournament id="3" name="ATP - Basel, Switzerland">
<Match id="8331188" name="Nadal, Rafael v Gasquet, Richard"
startDate="2015-10-31T13:30:00">
<MatchOdds>
<Bet id="20">
<Outcome Special="" name="1" odds="1.35" />
<Outcome Special="" name="2" odds="3.3" />
</Bet>
<Bet id="204">
<Outcome Special="" name="1" odds="1.45" />
<Outcome Special="" name="2" odds="2.85" />
</Bet>
<Bet id="231">
<Outcome Special="" name="1" odds="1.45" />
<Outcome Special="" name="2" odds="2.75" />
</Bet>
<Bet id="206">
<Outcome Special="" name="2 sets" odds="1.55" />
<Outcome Special="" name="3 sets" odds="2.35" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="12312333322" />
<Outcome Special="" name="2:1" odds="123123" />
<Outcome Special="" name="0:2" odds="123123123" />
<Outcome Special="" name="1:2" odds="123123123" />
</Bet>
</MatchOdds>
</Match>
</Tournament>
</Sport>
</Sports>
我想使用LINQ到XMl(Xdocument類),但我不知道如何。 你能幫我解決這個問題嗎? 在此先感謝
因此,您已發佈b滾動的XML:第4行10位的'Match'開始標記與'Tournament'的結束標記不匹配。第59行,第7位。 – spender
我冒昧修復和重新格式化XML。 – spender
謝謝!我很抱歉 –