public TemplateFactory(Map<String, String> namespaces) { context = XMLPathCtx.createNew(); context.addNamespaces(namespaces); }
public XPathContextFactory(Map<String, String> namespaces) { xmlPathCtx = XMLPathCtx.createNew(); xmlPathCtx.addNamespaces(namespaces); }
private Node find(final String xpath) { Node node = XMLPathCtx.createNew().addNamespaces(namespaces).findIn(sourceDocument).node(xpath).get(); if (node == null) { throw new IllegalArgumentException("XPath <" + xpath + "> must resolve to an node"); } return (Element) node; }