jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: (JCR-1.0) Restricting the length of a String property?
Date Fri, 27 Mar 2009 13:39:07 GMT
On Fri, Mar 27, 2009 at 2:27 PM, Daniel Manzke
<daniel.manzke@googlemail.com> wrote:
> <cut>
> In the JCR 1.0 SPEC there is no way to specify how long a String property
> could be.
> </cut>
> I meaned that there is no way in the custom_nodetypes.xml to specify the
> length of a String. (like <property ... length="10"/>)

What Stefan meant is the "value constraint" of a property definition,
not something that you would have to do manually in your application.
In the CND notation it is given with "< constraint" (see
http://jackrabbit.apache.org/node-type-notation.html). In the XML
notation the value constraints (there can be multiple) for a property
are given as sub-elements - each one containing a regular expression:

<propertyDefinition name="foobar" ...>

BTW, you should not modify the custom_nodetypes.xml directly but
rather use the proper node type registration code (see bottom of
http://jackrabbit.apache.org/node-types.html). Also, using the CND
notation is much easier.


Alexander Klimetschek

View raw message