Search in sources :

Example 1 with PSErrorListener

use of com.helger.schematron.xslt.util.PSErrorListener in project ph-schematron by phax.

the class PSXPathBoundSchema method _createXPathContext.

@Nonnull
private XPath _createXPathContext() {
    final MapBasedNamespaceContext aNamespaceContext = getNamespaceContext();
    final XPath aXPathContext = XPathHelper.createNewXPath(m_aXPathFactory, m_aXPathVariableResolver, m_aXPathFunctionResolver, aNamespaceContext);
    if ("net.sf.saxon.xpath.XPathEvaluator".equals(aXPathContext.getClass().getName())) {
        // Saxon implementation special handling
        final XPathEvaluator aSaxonXPath = (XPathEvaluator) aXPathContext;
        // Since 9.7.0-4 it must implement NamespaceResolver
        aSaxonXPath.setNamespaceContext(new SaxonNamespaceContext(aNamespaceContext));
        // Wrap the PSErrorHandler to a ErrorListener
        aSaxonXPath.getConfiguration().setErrorListener(new PSErrorListener(getErrorHandler()));
    }
    return aXPathContext;
}
Also used : MapBasedNamespaceContext(com.helger.xml.namespace.MapBasedNamespaceContext) XPath(javax.xml.xpath.XPath) SaxonNamespaceContext(com.helger.schematron.saxon.SaxonNamespaceContext) XPathEvaluator(net.sf.saxon.xpath.XPathEvaluator) PSErrorListener(com.helger.schematron.xslt.util.PSErrorListener) Nonnull(javax.annotation.Nonnull)

Aggregations

SaxonNamespaceContext (com.helger.schematron.saxon.SaxonNamespaceContext)1 PSErrorListener (com.helger.schematron.xslt.util.PSErrorListener)1 MapBasedNamespaceContext (com.helger.xml.namespace.MapBasedNamespaceContext)1 Nonnull (javax.annotation.Nonnull)1 XPath (javax.xml.xpath.XPath)1 XPathEvaluator (net.sf.saxon.xpath.XPathEvaluator)1