Given an user input string, how can I tell whether it is a valid Xpath expression or not in Java. Just curious, since I cannot find a way to do it using javax.xml.xpath library. Thanks.