jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject Re: namespaces
Date Wed, 16 Mar 2005 22:34:38 GMT
Tobias Strasser wrote:

>><?xml version="1.0" encoding="UTF-8"?>
>><site i18n:attr="label" label="Authoring"
>>    xmlns="http://apache.org/cocoon/lenya/sitetree/1.0"
>>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>    xsi:schemaLocation=
>>        "http://apache.org/cocoon/lenya/sitetree/1.0
>>        ../../../../resources/entities/sitetree.xsd"
>>    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
>> >....
>>and attach it to the node "/authoring"
>>3) After the import I take a look at the repository with the dump method
>>of the FirstSteps example and see
>>Node: /authoring/_pre10:site
>>Property: /authoring/_pre10:site/jcr:primaryType = nt:unstructured
>well, the problem is, that your
>"http://apache.org/cocoon/lenya/sitetree/1.0" namespace is defined on
>the element as default namespace but without a prefix. how should
>jackrabbit know, what prefix to use? i cannot use the empty prefix,
>because this one is already reserved. so it generates automatically
>the '_pre10' one.

right and this makes perfectly sense (I think for instance Mozilla
does something similar for its internal representation)

I think I have found the solution how we can do the mapping from xpath
to JCR Path by using a code snippet from Jukka's DocumentViewExportVisitor

String[] prefixes = session.getNamespacePrefixes();
for (int i = 0; i < prefixes.length; i++) {
  String namespace = session.getNamespaceURI(prefixes[i]);
  System.out.println("Namespace Prefix: " + prefixes[i]);
  System.out.println("Namespace: " + namespace);

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.

Thanks to all for the help


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

View raw message