public void setXPathFunctionResolver(XPathFunctionResolver resolver) { actual.setXPathFunctionResolver(resolver); }
/** * Creates a new customization info using the supplied * {@link Properties} object to resolve variables. * * @param properties contains variables and their values */ public PropertiesBasedCustomizationInfo(Properties properties) { this.properties = properties; XPathFactory xpfac = XPathFactory.newInstance(); xpfac.setXPathVariableResolver(new MyVariableResolver()); xpfac.setXPathFunctionResolver(new MyFunctionResolver()); HashMap<String, String> namespacePrefixes = new HashMap<String, String>(); namespacePrefixes.put("pfx", "http://www.pustefix-framework.org/2008/namespace/xpath-functions"); namespaceContext = new MapBasedNamespaceContext(namespacePrefixes); xpath = xpfac.newXPath(); xpath.setNamespaceContext(namespaceContext); try { dummyDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException("Can't create dummy document for XPath evaluation", e); } }
try { XPathFunctionResolver fresolver = (XPathFunctionResolver) JavaClassHelper.instantiate(XPathFunctionResolver.class, configurationEventTypeXMLDOM.getXPathFunctionResolver(), ClassForNameProviderDefault.INSTANCE); xPathFactory.setXPathFunctionResolver(fresolver); } catch (ClassInstantiationException ex) { throw new ConfigurationException("Error configuring XPath function resolver for XML type '" + configurationEventTypeXMLDOM.getRootElementName() + "' : " + ex.getMessage(), ex);
xPathFactory.setXPathFunctionResolver(fresolver);