C# .NET - Before inserting new element in xml check if exists.

Asked By Rahul Khanna on 20-Jul-14 01:58 PM

I have below a xml file with the below format:

<?xml version="1.0" encoding="utf-8" ?>

string newCountry="UAE"

I want to insert this "UAE" country to the above xml file, before that I want to check whether "UAE" is already exists in the xml. If not exists then only want to insert otherwise no operation. How can I do this?

xpath query examples - Robbe Morris replied to Rahul Khanna on 20-Jul-14 06:40 PM