jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Kogelnig <richard.kogel...@openforce.com>
Subject Re: XML import - only nt:unstructured?
Date Sat, 14 Jul 2007 01:02:33 GMT
Thanks for your reply Jukka,
> Before you can import content using custom node types, you need to
> have those node types registered. See the JackrabbitNodeTypeManager
> interface in the jackrabbit-api component.
I registered my Namespace and my Nodetype.
> Once the types are registered, an import will automatically use those 
> types if
> a) you explicitly provide the type information in a jcr:primaryType
> property in the XML import,
When I use this method everything works find, but
> b) the import is structured in a way that the repository can
> automatically infer the correct node types (using child node
> definitions in your node types) to be used.
Method b does not work, the nodes will get nt:unstructured, and
mandatory fields are not checked.

Here is some code:

> /* orig.namespaces */
> <mix = 'http://www.jcp.org/jcr/mix/1.0'>
> <nt = 'http://www.jcp.org/jcr/nt/1.0'>  
> // namespace declaration
> <test ='http://myhop/test'>
> [test:user] > nt:base
> - test:firstname primary m
> - test:lastname m
XML File:
> <?xml version="1.0" encoding="UTF-8"?>
> <users xmlns:jcr='http://www.jcp.org/jcr/1.0' 
> xmlns:test='http://myhop/test'>
>     <test:user jcr:primaryType="test:user" test:firstname="john" 
> test:lastname="doe" />
>     <test:user jcr:primaryType="test:user" test:firstname="jane" 
> test:lastname="doe" />
> </users>
If I remove the jcr:primaryType the node will get nt:unstructured and
mandatory fields will not be checked. (e.g. test:lastname missing)

I think i miss an important step.

I just defined a test:users nodetype set the primary type of users and
got what i wanted when i defined the default  node type of the childs

> [test:users] > nt:base
> + test:user  (test:user) =test:user multiple
But i still have to set the jcr:primaryType of the users element when.
Maybe I made a mistake with the namespaces and Jackrabbit is not able to
match the users/user node types with what it finds in the XML file?

Sorry for the rather confusing mail, I should go and get some sleep.

Greets and thanks for your help,

> BR,
> Jukka Zitting


View raw message