public String verifyXPathExpression ( final Iterable < XmlNsScheme > xmlNsSchemes , final String xpathExpression ) { LOG . trace ( "verifyXPathExpression: {}" , xpathExpression ) ; final XPathCompiler xPathCompiler = processor . newXPathCompiler ( ) ; for ( final XmlNsScheme xmlNsScheme : xmlNsSchemes ) { final String localPart = xmlNsScheme . getQName ( ) . getLocalPart ( ) ; final String namespaceUri = xmlNsScheme . getQName ( ) . getNamespaceURI ( ) ; LOG . trace ( "declareNamespace {}:{}" , localPart , namespaceUri ) ; xPathCompiler . declareNamespace ( localPart , namespaceUri ) ; } try { xPathCompiler . compile ( xpathExpression ) ; } catch ( final SaxonApiException e ) { return e . getCause ( ) . getMessage ( ) ; } return "" ; }
Utility method for verifying xpath expression