EDN Admin
Well-known member
Hello,
I have this XML file players.xml
<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px <table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap <tbody><tr><td><players>
<player>
<name>administrator</name>
<game>Cube</game>
<na_tahu>true</na_tahu>
<score>45</score>
<partner></partner>
<last_move></last_move>
</player>
<player>
<name>User2</name>
<game>Cube</game>
<na_tahu>true</na_tahu>
<score>16</score>
<partner></partner>
<last_move></last_move>
</player>
</players>
</td></tr></tbody></table> And I need to delete this whole element
<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px <table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap <tbody><tr><td><font style="font-size:11px </font><font style="color:blue <</font><font style="font-size:11px player</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue <</font><font style="font-size:11px name</font><font style="color:blue ></font><font style="font-size:11px User2</font><font style="color:blue </</font><font style="font-size:11px name</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td> <font style="color:blue <</font><font style="font-size:11px game</font><font style="color:blue ></font><font style="font-size:11px Cube</font><font style="color:blue </</font><font style="font-size:11px game</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue <</font><font style="font-size:11px na_tahu</font><font style="color:blue ></font><font style="font-size:11px true</font><font style="color:blue </</font><font style="font-size:11px na_tahu</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td> <font style="color:blue <</font><font style="font-size:11px score</font><font style="color:blue ></font><font style="font-size:11px 16</font><font style="color:blue </</font><font style="font-size:11px score</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue <</font><font style="font-size:11px partner</font><font style="color:blue ></font><font style="font-size:11px </</font><font style="color:black;font-weight:bold partner</font><font style="font-size:11px > </font></td></tr><tr><td> <font style="color:blue <</font><font style="font-size:11px last_move</font><font style="color:blue ></font><font style="font-size:11px </</font><font style="color:black;font-weight:bold last_move</font><font style="font-size:11px > </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue </</font><font style="font-size:11px player</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr></tbody></table> I can identify this element according to child elements <name> and <game>. So if <name>.InnerText="User2" & <game>.InnerText="Cube" then delete <player>...</player>
But I don´t know how to write code in C# for finding that right element player. Could somebody please help me how to delete this element?
View the full article
I have this XML file players.xml
<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px <table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap <tbody><tr><td><players>
<player>
<name>administrator</name>
<game>Cube</game>
<na_tahu>true</na_tahu>
<score>45</score>
<partner></partner>
<last_move></last_move>
</player>
<player>
<name>User2</name>
<game>Cube</game>
<na_tahu>true</na_tahu>
<score>16</score>
<partner></partner>
<last_move></last_move>
</player>
</players>
</td></tr></tbody></table> And I need to delete this whole element
<div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px <table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap <tbody><tr><td><font style="font-size:11px </font><font style="color:blue <</font><font style="font-size:11px player</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue <</font><font style="font-size:11px name</font><font style="color:blue ></font><font style="font-size:11px User2</font><font style="color:blue </</font><font style="font-size:11px name</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td> <font style="color:blue <</font><font style="font-size:11px game</font><font style="color:blue ></font><font style="font-size:11px Cube</font><font style="color:blue </</font><font style="font-size:11px game</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue <</font><font style="font-size:11px na_tahu</font><font style="color:blue ></font><font style="font-size:11px true</font><font style="color:blue </</font><font style="font-size:11px na_tahu</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td> <font style="color:blue <</font><font style="font-size:11px score</font><font style="color:blue ></font><font style="font-size:11px 16</font><font style="color:blue </</font><font style="font-size:11px score</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue <</font><font style="font-size:11px partner</font><font style="color:blue ></font><font style="font-size:11px </</font><font style="color:black;font-weight:bold partner</font><font style="font-size:11px > </font></td></tr><tr><td> <font style="color:blue <</font><font style="font-size:11px last_move</font><font style="color:blue ></font><font style="font-size:11px </</font><font style="color:black;font-weight:bold last_move</font><font style="font-size:11px > </font></td></tr><tr><td style="background-color:rgb(247, 247, 247) <font style="color:blue </</font><font style="font-size:11px player</font><font style="color:blue ></font><font style="font-size:11px </font></td></tr></tbody></table> I can identify this element according to child elements <name> and <game>. So if <name>.InnerText="User2" & <game>.InnerText="Cube" then delete <player>...</player>
But I don´t know how to write code in C# for finding that right element player. Could somebody please help me how to delete this element?
View the full article