jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting ...@yukatan.fi>
Subject Re: namespaces
Date Thu, 17 Mar 2005 05:22:18 GMT

Michael Wechner wrote:
> by stepping through all prefixes and according namespaces one
> can find out what prefix is being used by Jackrabbit and then the
> JCR path can be constructed.

Another way would be to use XPath search or whatever mechanism to locate
the Node you want to export and then get the JCR path with Node.getPath
(). For example:

    Node node = ...;
    session.exportDocView(node.getPath(), ...);

The Node.getPath() method will automatically do the prefix mappings for

Alternatively, you do not need to iterate through all the namespace
mappings to get the prefix for your namespace. You can use the
NamespaceRegistry.getPrefix() method, as shown below:

    NamespaceRegistry registry =

    String namespace = "http://apache.org/cocoon/lenya/sitetree/1.0";
    String prefix = registry.getPrefix(namespace);

    session.exportDocView("/authoring/" + prefix + ":site", ...);


Jukka Zitting

View raw message