progcod Posted August 29, 2013 Share Posted August 29, 2013 I need some help to understand the validation of xPath expression in PHP. I want to validate if a xPath expression is correct before i pass it to DOMXPath::query. Quote Link to comment Share on other sites More sharing options...
requinix Posted August 29, 2013 Share Posted August 29, 2013 If the XPath method (like SimpleXMLElement::xpath or DOMXPath::query) doesn't issue warnings in case of a syntax error, you can just run it and see if it works. Doesn't even have to match anything. Otherwise... probably need regular expressions, but one that would validate an XPath query would be insane. If you can restrict the query to a limited set of features then that'd help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.