code: 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 "";
      }
docs: Utility method for verifying xpath expression
  
  @param xmlNsSchemes namespaces list
  @param xpathExpression xpath expression to test
  @return empty string if expression is right, error otherwise