On Fri, Mar 27, 2009 at 2:27 PM, Daniel Manzke
<[email protected]> 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" ...>
    <valueConstraints>
        <valueConstraint>^.{1,5}$</valueConstraint>
        <valueConstraint>anothervalue</valueConstraint>
        <valueConstraint>regexp3</valueConstraint>
    </valueConstraints>
</propertyDefinition>

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.

Regards,
Alex

-- 
Alexander Klimetschek
[email protected]

Reply via email to