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
Hi,

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
you.

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 =
        session.getWorkspace().getNamespaceRegistry();

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

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

BR,

Jukka Zitting



Mime
View raw message