Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 44516 invoked from network); 13 Jun 2007 10:13:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2007 10:13:02 -0000 Received: (qmail 14979 invoked by uid 500); 13 Jun 2007 10:13:02 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 14949 invoked by uid 500); 13 Jun 2007 10:13:02 -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 14939 invoked by uid 99); 13 Jun 2007 10:13:02 -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 03:13:02 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [204.127.192.85] (HELO rwcrmhc15.comcast.net) (204.127.192.85) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2007 03:12:57 -0700 Received: from [192.168.0.8] (c-75-68-242-226.hsd1.vt.comcast.net[75.68.242.226]) by comcast.net (rwcrmhc15) with ESMTP id <20070613101236m1500srba8e>; Wed, 13 Jun 2007 10:12:36 +0000 Message-ID: <466FC3E2.8090609@comcast.net> Date: Wed, 13 Jun 2007 06:16:02 -0400 From: Dan Connelly User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: users@jackrabbit.apache.org Subject: Re: Importing and Exporting XML References: <11082908.post@talk.nabble.com> In-Reply-To: <11082908.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org woolly: The term "DocumentView" is slightly misleading. Its more like a Shredded And Annotated Document View. The xml document will get shredded into its constituent element nodes when you import it as "DocumentView". This import will not store a single, coherent document in the Repository. WebDav support in Jackrabbit, on the other hand, can be used to store the document as coherent text. Customized, hybrid approaches are possible to support structured content (partial shredding over WebDav). It depends on your use case how much (or how little) shredding you want. The metadata gets added to raw shreds during DocumentView import to indicate the Jackrabbit element node type structure. By default, node type will be nt:unstructured on raw nodes (not having metadata already). You can write a simple XSLT to strip out the metadata when you export. For import you can work this in reverse and add a custom structure using XSLT (but that may not be simple). It sounds like your use case (customized node editing) requires some custom node types. This can work nicely if the set of element tags is limited and fixed. Also, you probably also will need to add some custom xml processing (dom, sax or xslt). What xml editor are you using? I think XML Spy has integration features that would support partial shredding and customized document views. (But, I have never worked this.) -- Dan Connelly woolly wrote: > Hi all, > > Is it possible to import xml into a node, and then export that xml back out > to have the same xml-equivalent file? At the moment I'm trying: > > fis = new FileInputStream(inputFile); > session.importXML(node.getPath(), fis, > ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); > fis.close(); > > // followed by.... > out = new FileOutputStream(outputFile); > session.exportDocumentView(node.getPath(), out, true, false); > > The difference between inputFile and outputFile seems to be that there are > some additional jcr specific attributes. Is this necessary? > > What I'm really trying to do is manage an xml document (eventually many xml > documents), allow people to make changes to only certain parts of it, > versioning those parts and using other JackRabbit features. Is this the kind > of thing that JackRabbit was intended for? Or should I just load the xml > document in as a property of a node and deal with the other things myself? > > Thanks for any help, > > Phil. >