jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@day.com>
Subject Re: CND notation - sns
Date Fri, 28 May 2010 10:47:59 GMT
hi bruno

On Fri, May 28, 2010 at 12:11 PM, bruno coelho <bruno.coelho@gmail.com> wrote:
> hi,
>
> I'm trying to define a type of node that doesn't allow same name siblings
> (as everyone else :) ).
>
> I was looking for example of the new notation to define node types and
> looked in the source code of jackrabbit.
>
> I found this file:
> ./jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
> where the 'nt:unstructured' node is define like this:
>
> [nt:unstructured]
>  orderable
>  - * (UNDEFINED) multiple
>  - * (UNDEFINED)
>  + * (nt:base) = nt:unstructured sns VERSION
>
>
> my question is:
> what's the meaning of sns?
> does it mean same name siblings?

yes. the CND grammar is defined in an appendix
of the JCR 2.0 specification, see
http://www.day.com/specs/jcr/2.0/25_Appendix.html

<quote>
/* If 'sns' is present without a '?' then the child node
supports same-name siblings. If 'sns' is present with a '?'
then this attribute is a variant. If 'sns' is absent then
the child node does support same-name siblings. */
Sns ::= ('sns' | '*') ['?']
</quote>

>
> I have read this: http://jackrabbit.apache.org/node-type-notation.html but
> can't find a explanation for sns.
>
> if I want to define a node to that doesn't allow same name siblings and
> doesn't allow properties with the same name, can I just do this:

note that same-name properties are not allowed.

>
> <nt = 'http://www.jcp.org/jcr/nt/1.0'>
>
> [nt:nosamenamesiblings]
>  orderable
>  - * (UNDEFINED) multiple
>  - * (UNDEFINED)
>  + * (nt:base) = nt:nosamenamesiblings VERSION
>

yes. just omit the 'sns' keyword in your child node definition
in order to disallow same-name sibling child nodes.

BTW: the 'nt' prefix is reserved for built-in node types and
shouldn't be used for custom node types.

cheers
stefan

>
>
> thanks in advance for your help.
>
>
>
> best regards,
>
> bruno coelho
>

Mime
View raw message