On Mon, Jan 26, 2009 at 10:34 AM, Christofer Dutz <[email protected]> wrote:
> Hi Stefan,
>
> forget my last posting ;-)
>
> After reading your initial post again for one or two times, I found out what
> you suggested to do .. not to change the type oft he child I am adding, but
> the type of node I am adding to. After changing my folder node type to
> nt:unstructured everything works ... thanks.
>
> As I am very new to jackrabbit, are there anny major drawbacks to setting
> the node type to unstructured? To I throw overboard any major functionality?

no. nt:unstructured allows to import arbitrary xml data. IIUC that's
what you want to
do. if you do have fixed data structures you might want to consider
creating/using
custom note types.

cheers
stefan

>
> Chris
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Stefan Guggisberg [mailto:[email protected]]
> Gesendet: Montag, 26. Januar 2009 09:35
> An: [email protected]
> Betreff: Re: child node definition found for {}importxml
>
> On Mon, Jan 26, 2009 at 9:20 AM, Christofer Dutz <[email protected]> wrote:
>> Hi,
>>
>> thanks fort hat info. Unfortunately when using the file type, I get
>> different errors:
>
> who said you should use nt:file? i suggested using nt:unstructured...
>
> cheers
> stefan
>
>>
>> javax.jcr.nodetype.ConstraintViolationException: no definition found in
>> parent node's node type for new node: no matching child node definition
>> found for
>> {http://oval.mitre.org/XMLSchema/oval-definitions-5}oval_definitions: no
>> matching child node definition found for
>> {http://oval.mitre.org/XMLSchema/oval-definitions-5}oval_definitions
>>
>> The documents I am storing has a root element called oval_definition ...
>> unfortunately file-type seems to expect a content element. Is there a way
> to
>> avoid wrapping everything in a content element?
>>
>>
>> Chris
>>
>>
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Stefan Guggisberg [mailto:[email protected]]
>> Gesendet: Freitag, 23. Januar 2009 21:50
>> An: [email protected]
>> Betreff: Re: child node definition found for {}importxml
>>
>> hi chris
>>
>> On Fri, Jan 23, 2009 at 7:05 PM, Christofer Dutz <[email protected]> wrote:
>>> Hi,
>>>
>>>
>>>
>>> Yesterday I started playing around with jackrabbit. In the meanwhile i
>> think
>>> I have a lot of stuff worked out. Unfortunately I am missing one thing
>> form
>>> y prototype to work:
>>>
>>>
>>>
>>> I want to create the folowing structure:
>>>
>>>
>>>
>>> /definitions/{definition-documents}
>>>
>>>
>>>
>>> I managed to get the Xml Import working using the sessions
>>> getImportContentHandler method and quite some registerNamespace calls.
>>>
>>> Unfortunately this only seems to work when saving to direct children of
> my
>>> repository. As soon as I create a folder using
>>> "rootNode.addNode("definitions", "nt:folder");" I get the following
>>> stacktrace: (adding my xml content to a node called
> "/documents/importxml"
>>
>> the node type nt:folder only allows child nodes of type nt:hierarchyNode,
>> i.e. nt:folder and nt:file. it is used to model file system like
>> hierarchies.
>>
>> what you want to use is nt:unstructured, which allows child nodes of any
>> type.
>>
>> rootNode.addNode("definitions", "nt:folder");
>>
>> or
>>
>> rootNode.addNode("definitions");
>>
>> (nt:unstructured is the default).
>>
>> see e.g.
>>
>> rootNode.addNode("definitions", "nt:folder");
>>
>> for a description of some built-in used node types,
>> see e.g.
>>
>> http://wiki.apache.org/jackrabbit/NodeTypeRegistry
>>
>> cheers
>> stefan
>>
>>>
>>>
>>>
>>> javax.jcr.nodetype.ConstraintViolationException: no definition found in
>>> parent node's node type for new node: no matching child node definition
>>> found for {}importxml: no matching child node definition found for
>>> {}importxml
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:763)
>>>
>>>      at
>>> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:729)
>>>
>>>      at
>>> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:677)
>>>
>>>      at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:2110)
>>>
>>>      at
>>>
>>
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManager.addDef
>>> initions(JackrabbitPersistenceManager.java:264)
>>>
>>>      at
>>>
>>
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManagerTest.ad
>>> dDefintionsTest(JackrabbitPersistenceManagerTest.java:85)
>>>
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>>      at
>>>
>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>>> )
>>>
>>>      at
>>>
>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>>> .java:25)
>>>
>>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>>      at
>>>
>>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.
>>> java:44)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.j
>>> ava:15)
>>>
>>>      at
>>>
>>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.ja
>>> va:41)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.jav
>>> a:20)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
>>> )
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>>>
>>>      at
>>>
>>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
>>> a:73)
>>>
>>>      at
>>>
>>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
>>> a:46)
>>>
>>>      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>>>
>>>      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>>>
>>>      at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
>>> )
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>>>
>>>      at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRef
>>> erence.java:45)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
>>> 8)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
>>> nner.java:460)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
>>> nner.java:673)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
>>> java:386)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
>>> .java:196)
>>>
>>> Caused by: javax.jcr.nodetype.ConstraintViolationException: no matching
>>> child node definition found for {}importxml
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicableChildNode
>>> Def(EffectiveNodeType.java:730)
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.NodeImpl.getApplicableChildNodeDefinition(NodeImp
>>> l.java:873)
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:759)
>>>
>>>      ... 29 more
>>>
>>> javax.jcr.nodetype.ConstraintViolationException: no matching child node
>>> definition found for {}importxml
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicableChildNode
>>> Def(EffectiveNodeType.java:730)
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.NodeImpl.getApplicableChildNodeDefinition(NodeImp
>>> l.java:873)
>>>
>>>      at
>>>
>>
> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:759)
>>>
>>>      at
>>> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:729)
>>>
>>>      at
>>> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:677)
>>>
>>>      at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:2110)
>>>
>>>      at
>>>
>>
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManager.addDef
>>> initions(JackrabbitPersistenceManager.java:264)
>>>
>>>      at
>>>
>>
> de.upw.tiller.pgm.persistence.jackrabbit.JackrabbitPersistenceManagerTest.ad
>>> dDefintionsTest(JackrabbitPersistenceManagerTest.java:85)
>>>
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>>      at
>>>
>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
>>> )
>>>
>>>      at
>>>
>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>>> .java:25)
>>>
>>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>>      at
>>>
>>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.
>>> java:44)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.j
>>> ava:15)
>>>
>>>      at
>>>
>>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.ja
>>> va:41)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.jav
>>> a:20)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
>>> )
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>>>
>>>      at
>>>
>>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
>>> a:73)
>>>
>>>      at
>>>
>>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.jav
>>> a:46)
>>>
>>>      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>>>
>>>      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>>>
>>>      at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28
>>> )
>>>
>>>      at
>>>
>>
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
>>>
>>>      at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRef
>>> erence.java:45)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
>>> 8)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
>>> nner.java:460)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
>>> nner.java:673)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
>>> java:386)
>>>
>>>      at
>>>
>>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
>>> .java:196)
>>>
>>>
>>>
>>> I created the doczuments node using the following code:
>>>
>>>
>>>
>>> rootNode.addNode("definitions", "nt:folder");
>>>
>>>
>>>
>>> I think my problem must be some really simple problem. Unfortunately I
>> have
>>> tried figuring this out with google for quite some time now.
>>>
>>>
>>>
>>> Chris
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>

Reply via email to