You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Parker c <di...@gmail.com> on 2007/01/26 19:39:10 UTC

cnd example

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

RE: cnd example

Posted by Brian Thompson <BT...@sewardinc.com>.
-----Original Message-----
From: Parker c [mailto:dingo001@gmail.com] 
Sent: Friday, January 26, 2007 12:39 PM
To: users@jackrabbit.apache.org
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