I build a xpath string based on all filled-out fields in a form submitted by a user. In my xml document, not all form fields necessarily exist as nodes. When I try to do
doc.SelectNodes(xpath);
I get an exception System.Xml.XPath.XPathException that my xpath has an invalid token.
How can I modify the xpath string to only include those fields that do exist in the xml document and disregard all the others?