public static Map < String , String > getNamespaces ( final Session session ) { final NamespaceRegistry registry = getNamespaceRegistry ( session ) ; final Map < String , String > namespaces = new HashMap <> ( ) ; try { stream ( registry . getPrefixes ( ) ) . filter ( internalPrefix . negate ( ) ) . forEach ( x -> { try { namespaces . put ( x , registry . getURI ( x ) ) ; } catch ( final RepositoryException e ) { throw new RepositoryRuntimeException ( e ) ; } } ) ; } catch ( final RepositoryException e ) { throw new RepositoryRuntimeException ( e ) ; } return namespaces ; }
Retrieve the namespaces as a Map