-----Original Message-----
From: Parker c [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 26, 2007 12:39 PM
To: [email protected]
Subject: cnd example

Is there an example that shows how to create and import node types
declared in a cnd?

================================

Yes; look at the bottom of
http://jackrabbit.apache.org/doc/nodetype/index.html.

You need to register any namespaces you'll be using before you can
import a node using them, and your CND file needs to declare the
namespaces it's going to use.

An example CND file would look like

/* orig.namespaces */
<mix = 'http://www.jcp.org/jcr/mix/1.0'>
<nt = 'http://www.jcp.org/jcr/nt/1.0'>

/* Project-specific stuff */
<myproj = 'http://www.example.com/jcr-ns/myproj'>
<prefix = 'http://www.example.com/jcr-ns/prefix'>

[myproj:CustomNodeType] > nt:hierarchyNode, mix:referenceable
        orderable
        /* jcr:created (DATE) from nt:hierarchyNode */
        - prefix:propertyOne (string) mandatory VERSION
        - prefix:propertyTwo (string) multiple VERSION


Registering a namespace is done with:

ws.getNamespaceRegistry().registerNamespace("myproj",
"http://www.example.com/jcr-ns/myproj";);

and fits anywhere before the for loop in the example class given on
jackrabbit.apache.org


Good luck,

Brian

Reply via email to