jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Namespaces and Session.getImportContentHandler()
Date Wed, 04 Jun 2008 16:16:15 GMT
The problem was indeed on the SAX generator side. For the two top-level
namespace prefixes of my XMP packet, the start/endPrefixMapping()
methods were not called. The Xerces XML serializer seems to be immune to
such oversights which is why I haven't caught the bug in XG Commons
earlier. Thanks again for your input. One bug less in this world. ;-)

On 04.06.2008 16:32:18 Jeremias Maerki wrote:
> Thanks for the feedback, Stefan. In that case, I'll first have to make
> sure the problem is not on my side. ATM, the XML content is generated by
> Java code (XML Graphics Commons' XMP package) as SAX events. I'll see if
> the same happens if I load from an XML file to rule out any SAXish
> side-effects.
> 
> On 04.06.2008 16:18:26 Stefan Guggisberg wrote:
> > On Wed, Jun 4, 2008 at 4:09 PM, Jeremias Maerki <dev@jeremias-maerki.ch> wrote:
> > > I'm trying to import arbitrary XML content through
> > > Session.getImportContentHandler(). It works fine if I have XML content
> > > that is fully in the default namespace. But if there's mixed-namespace content
> > > I get the following error when calling Session.save():
> > >
> > > ERROR - failed to write bundle: 1b773746-508f-4176-ab3f-6bbf3d1b6bd9
> > > java.lang.IllegalStateException: URI not valid? javax.jcr.NamespaceException:
URI http://www.w3.org/1999/02/22-rdf-syntax-ns# is not registered.
> > >        at org.apache.jackrabbit.core.persistence.bundle.util.NamespaceIndex.stringToIndex(NamespaceIndex.java:55)
> > >        at org.apache.jackrabbit.core.persistence.bundle.util.ItemStateBinding.writeQName(ItemStateBinding.java:391)
> > >        at org.apache.jackrabbit.core.persistence.bundle.util.BundleBinding.writeBundle(BundleBinding.java:286)
> > >        at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:1262)
> > >        at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:703)
> > >        at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.store(AbstractBundlePersistenceManager.java:643)
> > >        at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.store(BundleDbPersistenceManager.java:526)
> > >        at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.end(SharedItemStateManager.java:704)
> > >        at org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:873)
> > >        at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:324)
> > >        at org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:306)
> > >        at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:300)
> > >        at org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:317)
> > >        at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1247)
> > >        at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
> > > <snip rest of stacktrace/>
> > >
> > > It seems like I have to preregister all used namespaces myself with the
> > > NamespaceRegistry. And I possibly have to do some namespace prefix
> > > normalization to avoid collisions if I don't have control over what
> > > namespace prefixes are used because there's only one NamespaceRegistry
> > > per workspace. Did I get that about right?
> > 
> > no, that shouldn't be necessary, all references namespaces in your xml document
> > should automatically be registered. seems to be a bug, could you perhaps
> > provide a sample xml document that fails on import?
> > 
> > cheers
> > stefan
> > 
> > 
> > >
> > > Thanks for your input,
> > > Jeremias Maerki
> > >
> > >
> 
> 
> 
> 
> Jeremias Maerki
> 




Jeremias Maerki


Mime
View raw message