I'm trying to check if a user exists from an XML response.
When a user doesn't exist the response is like this:
<ipb></ipb>
What would be the best way for me to (in code) verify that a user doesn't exist? I was thinking of checking if it didn't have any child elements but I'm somewhat confused.
Thanks for the help!
public void LoadUserById(string userID)
{
doc = XDocument.Load(String.Format("http://www.dreamincode.net/forums/xml.php?showuser={0}", userID));
if (doc.DescendantNodes().ToList().Count < 1)
{
userExists = false;
}
else
{
userExists = true;
}
}