You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sandor Spruit <sa...@cs.uu.nl> on 2011/01/18 14:25:46 UTC

Importing, and exporting XML. Default namespaces

Hello,

I just examined the Jackrabbit repository contents after importing a 
document with a default namespace (generated by an application that I 
need to work with)

It looks as though Jackrabbit adds its own 'ns' prefix in the absence of 
a prefix in the original document. This prefix pops-up when the document 
gets exported through the 'session.exportDocumentView'. So, any 
subsequent processing steps (XSLT) need to be aware of the prefix.

Is there a way to control what prefix Jackrabbit assigns to XML nodes in 
the default namespace?

I may need to import XML documents from several sources, each with their 
own default namespace; I'd like to distinguish between them, and assign 
a meaningful prefix.

regards, Sandor

-- 
Information and Computing Sciences, Utrecht University, the Netherlands
Personal coordinates: http://www.cs.uu.nl/staff/sandor.html
"It's a beautiful day, don't let it get away!", (U2, Beautiful day)

Re: Importing, and exporting XML. Default namespaces

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Jan 18, 2011 at 2:25 PM, Sandor Spruit <sa...@cs.uu.nl> wrote:
> Is there a way to control what prefix Jackrabbit assigns to XML nodes in the
> default namespace?

You can register the namespace before importing your XML content. See
NamespaceRegistry.registerNamespace() [1].

[1] http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/NamespaceRegistry.html#registerNamespace(java.lang.String,
java.lang.String)

BR,

Jukka Zitting