Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 92807 invoked from network); 13 Jun 2007 12:39:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2007 12:39:37 -0000 Received: (qmail 22684 invoked by uid 500); 13 Jun 2007 12:39:39 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 22667 invoked by uid 500); 13 Jun 2007 12:39:39 -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 22654 invoked by uid 99); 13 Jun 2007 12:39:39 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2007 05:39:38 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of alessandro.bologna@gmail.com designates 209.85.132.245 as permitted sender) Received: from [209.85.132.245] (HELO an-out-0708.google.com) (209.85.132.245) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2007 05:39:34 -0700 Received: by an-out-0708.google.com with SMTP id c37so40641anc for ; Wed, 13 Jun 2007 05:39:14 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=dehKeu43iF5EuKe6wuTk16tn4BDyh2/v9AglUivongDGZDUCdvosfLyNS4mxhQ2djUvLPjPFhaTUidtoFXASJGhpIn15xdHFbVZEWG8jWhGp/eQDu+e/p2Gr0EoAfvjrqUi5EHYiveA3zvacjWYIpEUaThEhAOXdOhMI0qjyORc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=cNXIT9F4xrghgKE0woRLZ9a1wCxPPlK7yJXqQH3jtE79NgUN7XMzhUrtNnA1Y0XoJP4Oj5LPCkRok2li43QAmFedJHVxkoqdMvZg+fIMfxSd1aG3dBKNhyVJTXEI5C1UoioRc7NEqJzfod+m0ZXFbPIjx7WClNlLaouuoTHmL1s= Received: by 10.100.206.11 with SMTP id d11mr299279ang.1181738353880; Wed, 13 Jun 2007 05:39:13 -0700 (PDT) Received: from ?192.168.128.101? ( [74.66.251.221]) by mx.google.com with ESMTP id b23sm1004162ana.2007.06.13.05.39.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jun 2007 05:39:12 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <90a8d1c00706130522k42f55f3fn3ee8a32006a672e5@mail.gmail.com> References: <90a8d1c00706130522k42f55f3fn3ee8a32006a672e5@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <1DBE6C14-8BEF-4E10-989F-128AFD893F7B@gmail.com> Content-Transfer-Encoding: quoted-printable From: Alessandro Bologna Subject: Re: Importing and Exporting XML Date: Wed, 13 Jun 2007 08:39:03 -0400 To: users@jackrabbit.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org Stephan, I agree that DocumentView will not allow proper roundtripping (when =20 the source is a JCR model). At the same time, when the source is an =20 XML document, DocumentView does (and SystemView does not), and this =20 was the case in question. To address Frederic point of view, I think that when it comes to =20 multivalued properties (which do not really happen often in XML, so =20 we are dealing with roundtripping from a JCR model), one approach is =20 to use SystemView (and then maybe transform it in something more =20 human readable), or to use a SAX handler and the visitor pattern for =20 a customized output (as in the DocumentViewExportVisitor class). Of course, I realize that there can be use cases when it is not =20 practical, and then probably there's no one solution-fits-all. Alessandro On Jun 13, 2007, at 8:22 AM, Stefan Guggisberg wrote: > On 6/13/07, Fr=E9d=E9ric Esnault wrote: >> Of course, in wolly's case, it doesn't really matter, but =20 >> jackrabbit is not supposed to be a "one use product", but a =20 >> generic JCR. And I just tried my own use case, which is not a very =20= >> odd case, where I have some contracts referencing contractors by =20 >> reference. And with a document view, I loose these references, the =20= >> contract managers also multivalued, and so on. >> >> I don't know how you export references, because I can't. > > the answer is simple: use system view export. > > see http://issues.apache.org/jira/browse/JCR-325 for a > discussion of multi-valued property representation in the > document view xml mapping. > > please see also section 6.4.2.5 in the JSR 170 spec. > > cheers > stefan > > > >> >> Fr=E9d=E9ric Esnault >> >> -----Message d'origine----- >> De: Alessandro Bologna [mailto:alessandro.bologna@gmail.com] >> Envoy=E9: mercredi 13 juin 2007 13:55 >> =C0: users@jackrabbit.apache.org >> Objet: Re: Importing and Exporting XML >> >> Frederic, >> >> Some multivalued properties are handled correctly (say for instance >> multivalued references are exported as space separated lists of >> references in an attribute), and in some other cases it's still >> possible to do an encoding of the values, so that they can be >> represented inside an XML attribute. But I agree that in some cases >> it's really not practical (say binary properties...) because the XML >> that would result would probaby be not very much readable. >> >> But in Wolly's (or Phil's?) case, the problem is to round-trip XML, >> which does not have multi-valued properties to start with (so it >> doesn't really matter, does it?) >> >> Alessandro. >> >> >> On Jun 13, 2007, at 7:43 AM, Fr=E9d=E9ric Esnault wrote: >> >> > What about the multivalued properties not included in the export? >> > The exported document, even if it's modified by XSL/java is still >> > incorrect, as the multivalued properties are simply ignored. >> > >> > I know the JSR 170 spec leaves the right to do so, but imo it >> > creates an incoherent export. I don't think anyone even think about >> > the possibility that some properties are just ignored when doing an >> > export from a CMS... >> > >> > Fr=E9d=E9ric Esnault - Ing=E9nieur R&D >> > >> > >> > -----Message d'origine----- >> > De : Alessandro Bologna [mailto:alessandro.bologna@gmail.com] >> > Envoy=E9 : mercredi 13 juin 2007 13:34 >> > =C0 : users@jackrabbit.apache.org >> > Objet : Re: Importing and Exporting XML >> > >> > Yes. Two ways: >> > 1. Java way: use the DocumentViewExportVisitor and override the >> > includeProperty() method (simply return false if the property has a >> > namespace you don't want). >> > >> > 2. XML way: use an XSLT identity transformation and add rules for >> > removing any attribute that you don't want. >> > >> > Alessandro >> > >> > >> > On Jun 13, 2007, at 7:20 AM, woolly wrote: >> > >> >> >> >> Thanks for replying... >> >> >> >> If I have a document like this: >> >> >> >> >> >> edam >> >> lancashire >> >> cheshire >> >> stilton >> >> >> >> >> >> ...and I import it using: >> >> fis =3D new FileInputStream(inputFile); >> >> session.importXML(node.getPath(), fis, >> >> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); >> >> fis.close(); >> >> >> >> ...when I export it using: >> >> out =3D new FileOutputStream(outputFile); >> >> session.exportDocumentView(node.getPath(), out, true, false); >> >> >> >> ...I get: >> >> >> >> >> >> > >> xmlns:jcr=3D"http://www.jcp.org/jcr/1.0" >> >> xmlns:nt=3D"http://www.jcp.org/jcr/nt/1.0" >> >> xmlns:sv=3D"http://www.jcp.org/jcr/sv/1.0" >> >> xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" >> >> xmlns:xs=3D"http://www.w3.org/2001/XMLSchema" >> >> xmlns:fn=3D"http://www.w3.org/2005/xpath-functions" >> >> xmlns:fn_old=3D"http://www.w3.org/2004/10/xpath-functions" >> >> xmlns:mix=3D"http://www.jcp.org/jcr/mix/1.0" xmlns:rep=3D"internal" >> >> jcr:primaryType=3D"nt:unstructured"> >> >> edam >> >> lancashire >> >> cheshire >> >> stilton >> >> >> >> >> >> ...is there any way to just get the original document out? >> >> >> >> Thanks, >> >> >> >> Phil. >> >> >> >> >> >> Julian Reschke wrote: >> >>> >> >>> woolly wrote: >> >>>> Surely then I would want to use some form of document view, >> >>>> then, in >> >>>> order to >> >>>> get back the original document I put in? >> >>> >> >>> Yes (contrary to what you've been told here before). >> >>> >> >>> There are known limitations with the document view (such as >> >>> restrictions >> >>> with multivalued props). But the thing you complained about was >> >>> something else; maybe unneeded attributes in the jcr namespace? >> >>> Could >> >>> you be a bit more specific about that problem? >> >>> >> >>> Best regards, Julian >> >>> >> >>> >> >>> >> >> >> >> -- >> >> View this message in context: http://www.nabble.com/Importing-and- >> >> Exporting-XML-tf3908819.html#a11097246 >> >> Sent from the Jackrabbit - Users mailing list archive at =20 >> Nabble.com. >> >> >> > >> >>