jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject [SUMMARY] [WAS:Re: namespaces]
Date Thu, 17 Mar 2005 08:09:57 GMT
Jukka Zitting wrote:

>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", ...);
>  
>

cool, thanks a lot for your help

Michi

>BR,
>
>Jukka Zitting
>
>
>
>  
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


Mime
View raw message