How can I change a given xpath string only for nodes that exist in a specific XML document

I am building an xpath string based on all filled fields in a user submitted form. In my XML document, not all form fields necessarily exist as nodes. When I try to do

doc.SelectNodes (XPath);

I am getting System.Xml.XPath.XPathException that my xpath has an invalid token.

How can I change the xpath string to include only those fields that exist in the XML document and ignore all others?

0


a source to share


1 answer


When you get an invalid token error, it means that there is an invalid character or invalid xpath in your request. Sample xml samples and some xpaths would be very helpful.



+3


a source







All Articles