try {
// dummy namespace registrations to make sure sling JCR resolver
// does not get mixed up with the prefixes
NamespaceRegistry namespaceRegistry = resolver.adaptTo(Session.class).getWorkspace()
.getNamespaceRegistry();
namespaceRegistry.registerNamespace("sling", "http://mock/sling");
namespaceRegistry.registerNamespace("app", "http://mock/app");
namespaceRegistry.registerNamespace("dam", "http://mock/dam");
} catch (RepositoryException ex) {
throw new RuntimeException("Unable to register namespaces.", ex);
}