Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 34752 invoked from network); 5 Mar 2009 09:31:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Mar 2009 09:31:19 -0000 Received: (qmail 32402 invoked by uid 500); 5 Mar 2009 09:31:17 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 32383 invoked by uid 500); 5 Mar 2009 09:31:17 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 32372 invoked by uid 99); 5 Mar 2009 09:31:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2009 01:31:17 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of stefan.guggisberg@gmail.com designates 209.85.220.158 as permitted sender) Received: from [209.85.220.158] (HELO mail-fx0-f158.google.com) (209.85.220.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Mar 2009 09:31:09 +0000 Received: by fxm2 with SMTP id 2so3163745fxm.43 for ; Thu, 05 Mar 2009 01:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=VCosgIsW+SBO/BLmfa0uZQDrHWkQD6tho7xwOMR8iPo=; b=jufNZdeC/U2m+JW583DQr5jp1gNFTPShcoaFJzQmQOiw40k+d8aWJD3QkauzjyriRX nSJxJbtwIbtVYDrn25X73HxMkb/ydG0iPRGl9P1i74Vvdu7r8BLdWtqr55Cybsk8x6hd hNxUmvPuQ71Ga8wZ94Zp5NyHdJ1Cd+2KxRLpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=s/CHTb1psvAMGYSE15PUJqY1TPa4YwEJq46l9NG0IiqaBhAY3mryVAN+zMQ1SaFBNS D6CviTND0jXf/sxl6lXjlrzVw74cngmXrISqAlTXMZ1tywiVbfBHMq+Jnnqkf6nZoLIp Bt0bOj0r4KkfGdfI41kO8hdI8YHo2p0ps9U7M= MIME-Version: 1.0 Received: by 10.223.105.195 with SMTP id u3mr770262fao.13.1236245449492; Thu, 05 Mar 2009 01:30:49 -0800 (PST) In-Reply-To: References: Date: Thu, 5 Mar 2009 10:30:49 +0100 Message-ID: <90a8d1c00903050130h7f603826if6d6e38482b4f09c@mail.gmail.com> Subject: Re: differentiating elements and attributes in CND From: Stefan Guggisberg To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org hi cris On Thu, Mar 5, 2009 at 3:48 AM, Cris Daniluk wrote= : > I apologize if this is a question that has been asked and answered, but i= t > was difficult to identify in perusing docs/archives. I'm trying to import= a > legacy XML format that utilizes elements where attributes should be used. > Rather than map it to a new format for storage in Jackrabbit, I'd like to > keep the existing format so that users are able to XQuery as expected. > However, when I use the following CND: > > [recordType] > nt:base, mix:referenceable > =A0orderable > =A0- shouldBeAnAttr (string) mandatory > > [records] > =A0- record (recordType) =3D recordType multiple > > I cannot import the following XML: > > > =A0ShouldBeTheValueOfAnAttr > > > It isn't a huge shock that it doesn't work with the CND notation. However= , I > can't figure out what the notation *should* be. I've played around with > various options with the + (child) notation, but I can't get it to roll u= p > the CDATA into a value. Is there a way to do this? Do I need a custom > NodeType? no, custom node types won't buy you anything here. xml elements will always be imported as jcr nodes, xml attributes will be imported as jcr properties. for more information please see "6.4.2 Document View XML Mapping" in the jsr 170 spec. while you could write your own importer, based on the jackrabbit implementation, i wouldn't advise it. it's probably better if you transform your xml (i.e. make those elements attrubutes) before importing it. i am not an xml crack but i guess it should be relatively easy by using xslt. cheers stefan > > More importantly, what do others do when trying to import XML like this i= nto > JackRabbit? Since it is all validating against the DTD before submission = to > the repository, would it be better off to just leave the recordType as > nt:unstructured? > > Thanks for your input! > > Cris >