By null do you mean that an element does not exist?
try { var n = doc.SelectSingleNode("WhoisRecord/registrant/email"); if (n == string.Empty) { // empty value } // has value DoSomething(n.InnerText); } catch (XPathException) { // null value. throw; }
I'm not sure if this is correct, I need to check it out.
source share