Defining Nodetypes: CND

A compact node type definition is used by JCR (Jackrabbit) to define the possibilities of a JCR node.

The CND is sufficient for using the Hippo JCR repository. Only if you want to use the CMS, which is a GUI to the Hippo JCR repository, you need additional node type definitions, which can be found in the repository under one of the CMS namespace nodes under the hippo:namespaces node.

Introduction

The complete specification of the compact node type definition of JCR (Jackrabbit) can be found at http://jackrabbit.apache.org/node-type-notation.html.

The CND itself can not be found in the repository, but can be exported from the web console.
The node type definition defines which items (child nodes and properties) a node may or must have and of which type. It also defines if multiple values of the item are allowed. Node type definitions can inherit from other node type definitions.
The syntax of a CND document is a very compact one, not XML.

A node type name consists of a namespace and a local name. Just like with XML, the namespace is identified by a URL that is supposed to unique in the whole world. Without some environment (like a CND), the namespace is identified by the much shorter namespace prefix. The namespace prefix is coupled to the namespace URL by a namespace declaration at the top of a CND document. Several namespace can be declared. All namespaces of which a prefix is used have to be declared.

Below, you see a simple example of a CND.


  1. Lines 1-3 declare the namespace prefixes.
  2. The note type tutorial:textpage is being defined (written between [ ]).
  3. it inherits from hippo:publishable, hippostd:publishableSummary and hippo:document (listed after >)
  4. it has (additional) properties tutorial:summary and tutorial:title, which are of type string. Properties are marked by leading -. 
  5. it has (additional) child tutorial:body, which is of type hippostd:html. Children are marked by leading +.

Of course, more node types can be defined in a single CND file. Child nodes may be of a type defined in the same namespace. Note that in a CND file the definition of a note type has to come before any use of the node type. The CND specification says: 'Namespace prefixes referenced in a node type definition block must be declared in a preceding namespace declaration block.'

CND's can contain more rules. It is for example possible to define:

  • a property or child node to be mandatory.
  • a property may be multi-valued, while a child node may allow same-name sibblings. Note that this is indicated by the same keyword: multiple, while the meaning is not exactly the same.
  • A residual property or child node defintion, which applies to a property or child node of any name. This is indicated by a * instead of the name. Note that if a residual child node defintion is supplied, multiple child nodes of any name are allowed even without the keyword 'multiple', as long as the names are different and not equal to other defined names.

Hippo Europe: +31 (0)20 5224466
Hippo North America: +1 (707) 773-4646