Validating xpath

17 Mar

How can I verify a given xpath string is valid in C#/. I'm not sure just running the XPath and catching exceptions is a valid solution (putting aside the bile in my throat for a moment) - what if tomorrow I run into some other input I haven't tested against?Allows you to test your XPath expressions/queries against a XML file. Results bigger than 500k will be written to a new window for performance reason and to prevent your browser from being unresponsive.The first way to validate an XML document is to validate the document as it is loaded into an Xml Document object using a validating Xml Reader object.

validating xpath-31validating xpath-14validating xpath-74

You can also perform read-only validation of XML content using the XPath Document class.The Xml Reader Settings object passed as a parameter has a Validation Type property set to and an XML Schema for the XML document contained in the Xml Document object added to its Schemas property. Using the Xml Document class, you can validate the XML content contained in an Xml Document object in two ways. Choose 'View XPath' in the context menu and it will show the editor.You can edit the XPath expression and it incrementally updates the results.