Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 51315 invoked from network); 16 Mar 2005 22:27:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Mar 2005 22:27:17 -0000 Received: (qmail 58159 invoked by uid 500); 16 Mar 2005 22:27:17 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 58146 invoked by uid 99); 16 Mar 2005 22:27:17 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of david.nuescheler@gmail.com designates 64.233.170.197 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.197) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 16 Mar 2005 14:27:15 -0800 Received: by rproxy.gmail.com with SMTP id z35so286116rne for ; Wed, 16 Mar 2005 14:27:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=l2L1SPz35iY/rbaqL77dq4tD6oQwBm0xQbyfRqBd6xo4F0cDpU9aHCjHEVg3LZmNgW2DTSB1lgJqFg2IgBlBIKmz9yCD2YgZBDT8BTVvdac8H2h/cQvFsZ1FfGkBeaa0uFveOSXK8jJKielFMgJTyFTjEKcBilcDCdqgw3y9zYI= Received: by 10.38.65.14 with SMTP id n14mr1001712rna; Wed, 16 Mar 2005 14:27:13 -0800 (PST) Received: by 10.38.11.73 with HTTP; Wed, 16 Mar 2005 14:27:13 -0800 (PST) Message-ID: Date: Wed, 16 Mar 2005 23:27:13 +0100 From: David Nuescheler Reply-To: david.nuescheler@day.com To: jackrabbit-dev@incubator.apache.org Subject: Re: namespaces In-Reply-To: <4238ABA1.5040801@wyona.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit References: <423835EC.6010802@wyona.com> <8be73188050316053744daf9e4@mail.gmail.com> <42385160.8@wyona.org> <3df33a250503161013307b03ef@mail.gmail.com> <4238ABA1.5040801@wyona.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N hi michi, > 1) I create a node "/authoring" > 2) I import an XML with the following namespaces: > > > 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 > Property: /authoring/_pre10:site/i18n:attr = label > Property: /authoring/_pre10:site/label = Authoring > Property: /authoring/_pre10:site/xsi:schemaLocation = > http://apache.org/cocoon/lenya/sitetree/1.0 > ../../../../resources/entities/sitetree.xsd > which means Jackrabbit "renamed" the prefix of the default namespace > http://apache.org/cocoon/lenya/sitetree/1.0 > to "_pre10" for its "internal" representation > 4) I want to retrieve the node > "/authoring/_pre10:site" > which works of course ;-) but I don't want to hardcode the prefix > "_pre10" of course > because it could be anything, only the namespace should matter. That's > why I thought > one has to do it as with XPath. jackrabbit automatically registers namespaces in the repository namespace registry upon xml import in case the namespace is not already registered. now, since for the initial registration of a namespace we need a prefix and a uri. with everything else but the default namespace we use the prefix from the xml for the initial registration, with default namespaces we cannot come up with a generally descriptive namespace. the _preXX should never be used in code but should be remapped after the initial registration with registerNamspace() or should be registered even before your initial import. [maybe something like lenya-st:] once registered, the default prefix is set for this namespace but can also be remapped temporarily (session scoped) or permanently at any point. to test how the namespace registry works i would suggest looking at: http://jsr170tools.day.com/crx/nodetypes/namespaces.jsp and see impact on http://jcr.day.com (to modify you will have to login [admin/admin]) i registered the namespace in question for your convenience, and created a node and a prop using that namespace. does that help? regards, david