// Setting namespace context to XPath
// Assuming that the namespace prefix in the mapping xpath is the same as the one used in the document
final PrefixResolver resolver = new PrefixResolverDefault(doc.getDocumentElement());
NamespaceContext ctx = new NamespaceContext() {
public String getNamespaceURI(String prefix) {
return resolver.getNamespaceForPrefix(prefix);
}
// Dummy implementation - not used!
public Iterator getPrefixes(String val) {
return null;
}