jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Bologna <alessandro.bolo...@gmail.com>
Subject Re: Importing and Exporting XML
Date Wed, 13 Jun 2007 11:33:54 GMT
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:
> <?xml version="1.0" encoding="UTF-8"?>
> <cheeses>
> 	<cheese>edam</cheese>
> 	<cheese>lancashire</cheese>
> 	<cheese>cheshire</cheese>
> 	<cheese>stilton</cheese>
> </cheeses>
>
> ...and I import it using:
> fis = new FileInputStream(inputFile);
> session.importXML(node.getPath(), fis,
> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
> fis.close();
>
> ...when I export it using:
> out = new FileOutputStream(outputFile);
> session.exportDocumentView(node.getPath(), out, true, false);
>
> ...I get:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cheeses xmlns:dc="http://www.purl.org/dc/elements/1.1/"
> xmlns:jcr="http://www.jcp.org/jcr/1.0"
> xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
> xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fn="http://www.w3.org/2005/xpath-functions"
> xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions"
> xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:rep="internal"
> jcr:primaryType="nt:unstructured">
>     <cheese jcr:primaryType="nt:unstructured">edam</cheese>
>     <cheese jcr:primaryType="nt:unstructured">lancashire</cheese>
>     <cheese jcr:primaryType="nt:unstructured">cheshire</cheese>
>     <cheese jcr:primaryType="nt:unstructured">stilton</cheese>
> </cheeses>
>
> ...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 Nabble.com.
>


Mime
View raw message