LocalNamespaceRegistry extends SimpleNamespaceRegistry { @Override public String register( String prefix, String namespaceUri ) { String previous = super.register(prefix, namespaceUri); if (previous == null && delegate != null) previous = delegate.getPrefixForNamespaceUri(namespaceUri, false); return previous; } LocalNamespaceRegistry( NamespaceRegistry delegate );  LocalNamespaceRegistry( NamespaceRegistry delegate,
                                   final String defaultNamespaceUri ); @Override String getDefaultNamespaceUri(); @Override String getNamespaceForPrefix( String prefix ); @Override Set<Namespace> getNamespaces(); Set<Namespace> getLocalNamespaces(); @Override String getPrefixForNamespaceUri( String namespaceUri,
                                            boolean generateIfMissing ); @Override Set<String> getRegisteredNamespaceUris(); @Override boolean isRegisteredNamespaceUri( String namespaceUri ); @Override String register( String prefix,
                            String namespaceUri ); @Override boolean unregister( String namespaceUri );  }
@Test public void shouldAllowLocalRegistryToChangeDefaultNamespace() { local.register("", uri); assertNamespaces(delegate, ""); assertNamespaces(local, "=" + uri); }