jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: NodeDefinition.getDefaultPrimaryType()
Date Fri, 02 Sep 2005 15:08:06 GMT
On 9/1/05, lists <lists@digby.net> wrote:
> Hi,
> 
> I'm just wondering if I've found a bug with the above method, or if I
> just don't understand the way it should work.
> 
> I have the following content type defined (stripped down a little):
> 
>    <nodeType name="article" isMixin="false"
> hasOrderableChildNodes="true" primaryItemName="">
>      <childNodeDefinition name="*" defaultPrimaryType="paragraph"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" sameNameSiblings="true" />
>      <childNodeDefinition name="*" defaultPrimaryType="attachment"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" sameNameSiblings="true" />
>    </nodeType>
> 
> When i run the following code (where nt is the article NodeType):
> 
> NodeDefinition[] defs = (NodeDefinition[]) nt.getChildNodeDefinitions();
> for (int i=0; i<defs.length; i++) {
>      System.out.println(defs[i].getDefaultPrimaryType().getName());
> }
> 
> I get:
> attachment
> attachment
> 
> rather than:
> paragraph
> attachment
> 
> Is this expected?

nope, that's a bug, or more precisely: a side effect of a bug in the
node type validation
code. your node type contains ambiguous child node definitions, i.e. your
node type definition is not valid.

i fixed this issue in rev. 267220.

btw: your definitions are missing the supertypes declaration, but
that's another issue.

cheers
stefan

> 
> Many thanks in advance,
> 
> Digby
> 
>

Mime
View raw message