jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woolly <p.b...@lbs-ltd.com>
Subject Re: Importing and Exporting XML
Date Thu, 14 Jun 2007 13:06:57 GMT

Hi there,

I've got a hold of DocumentViewExportVisitor from the contrib section as
suggested, and added the jar files xercesImpl-2.8.1.jar and
commons-codec-1.3.jar that it appeared to require. I then subclassed
DocumentViewExportVisitor like this:

public class CleanDocumentViewExportVisitor extends
	public CleanDocumentViewExportVisitor(ContentHandler handler, boolean
skipBinary, boolean noRecurse)
		super(handler, skipBinary, noRecurse);
	protected boolean includeProperty(Property property) throws
		return !property.getName().startsWith("jcr:");

.....and exported my document using this:

SAXTransformerFactory factory = (SAXTransformerFactory)
TransformerHandler handler = factory.newTransformerHandler();
handler.setResult(new StreamResult(output));
node.accept(new CleanDocumentViewExportVisitor(handler, skipBinary,

....but I end up with the following (based on my original <cheeses>

<?xml version="1.0" encoding="UTF-8"?>
<cheeses xmlns:dc="http://www.purl.org/dc/elements/1.1/"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:rep="internal">

Why does JCR need to add all these namespaces to my root node on export?
They're not shown as properties when they are stored in the repository, and
I can't affect them as they are never passed through includeProperty().



Alessandro Bologna wrote:
> Jukka,
> yes no problems. I will file it as a bug. And yes, I think that  
> exportVisitor, providing a simple way to customize the XML  
> presentation of a JCR subtree is quite useful for a RESTful XSLT  
> presentation layer of a JCR. In fact, that's why I use it.
> Alessandro
>   On Jun 13, 2007, at 9:25 AM, Jukka Zitting wrote:
>> Hi,
>> On 6/13/07, Alessandro Bologna <alessandro.bologna@gmail.com> wrote:
>>> Just be sure to fix the line in escapeName(), otherwise you will not
>>> like the document that much...
>>>         >if ((i == 0) ? XMLChar.isNCNameStart(ch) :  
>>> XMLChar.isNCName(ch)) {
>>>         <if ((i == 0) ? !XMLChar.isNCNameStart(ch) : ! 
>>> XMLChar.isNCName(ch)) {
>>> The test should be with a not (!).
>>> I forgot to mention that in my previous reply, and maybe the project
>>> owner can fix it?
>> Sure, thanks for catching that! Could you file a a bug report for  
>> that?
>> If there's interest in the ExportVisitor functionality, we could make
>> it available in jackrabbit-jcr-commons in the 1.4 release.
>> BR,
>> Jukka Zitting

View this message in context: http://www.nabble.com/Importing-and-Exporting-XML-tf3908819.html#a11119815
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message