Thank you, but User2 can play some different games so I need to specify game as well to delete right element. Can I somehow join two conditions "/players/player[name='User2']" && "/players/player[game='Cube']"?

Why would you want to do it? Cube does not seem to be a good identifier. It is present as an XmlNode InnerText in two different nodes. If the Cube were unique then you will have to iterate thru sub nodes and identify it.

Thank you, but User2 can play some different games so I need to specify game as well to delete right element. Can I somehow join two conditions "/players/player[name='User2']" && "/players/player[game='Cube']"?

Thank you, but User2 can play some different games so I need to specify game as well to delete right element. Can I somehow join two conditions "/players/player[name='User2']" && "/players/player[game='Cube']"?

Why would you want to do it? Cube does not seem to be a good identifier. It is present as an XmlNode InnerText in two different nodes. If the Cube were unique then you will have to iterate thru sub nodes and identify it.

I´m doing such "game server" when various users can play various games and when someone finishes his game, then I need to erase that record from XML. So I identify player according to name of game (<game>) and name of player (<name>).

And second problem, I didn´t mention yet. I have name of player and name of game in two variables (String player="User2";...). Can I somehow in "/players/player[name='User2']" instead of text 'User2' insert variable player?

doc is the XmlDocument that you opened. I tend to wrap my doc.Load statement in a try-except statement, because the Load method will raise an exception if it cannot load the xml document for some reason.