Help with nested elements

View: New views
3 Messages — Rating Filter:   Alert me  

Help with nested elements

by Andrea Chiumenti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello I'd like to create something similar to this:

<item id="a">
    <item id="a-1">
        <item id="a-1-1"/>
        <item id="a-1-2"/>
        <item id="a-1-3"/>
    </item>
    <item id="a-2">
        <item id="a-2-1"/>
        <item id="a-2-2"/>
    </item>
</item>

I've defined this, but It's wrong:
       <element name="item">
            <attribute name="id" required="true"/>
            <attribute name="parentId" required="false"/>
            <attribute name="order" required="false"/>           
            <attribute name="label" required="false"/>
            <element name="item">
                <rules>
                    <invoke-parent method="addNode"/>
                </rules>
            </element>
            <conversion class="MyItem" />
        </element>

Can someone please tell me how to do ?

Thanks,
kiuma


Re: Help with nested elements

by Knut Wannheden :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kiuma,

In your schema (at least in the snippet you included) there are only
two nesting levels defined whereas in the example you've got 3 nested
<item> elements. And as you probably know HiveMind doesn't allow
recursive Schema definitions.

HTH,

--knut

On 3/31/07, Andrea Chiumenti <kiuma72@...> wrote:

> Hello I'd like to create something similar to this:
>
> <item id="a">
>     <item id="a-1">
>         <item id="a-1-1"/>
>         <item id="a-1-2"/>
>         <item id="a-1-3"/>
>     </item>
>     <item id="a-2">
>         <item id="a-2-1"/>
>         <item id="a-2-2"/>
>     </item>
>  </item>
>
> I've defined this, but It's wrong:
>        <element name="item">
>             <attribute name="id" required="true"/>
>             <attribute name="parentId" required="false"/>
>             <attribute name="order" required="false"/>
>             <attribute name="label" required="false"/>
>             <element name="item">
>                 <rules>
>                     <invoke-parent method="addNode"/>
>                 </rules>
>             </element>
>             <conversion class="MyItem" />
>         </element>
>
> Can someone please tell me how to do ?
>
> Thanks,
> kiuma
>
>

Re: Help with nested elements

by Andrea Chiumenti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you kunt.

Now, since I'm building a menu generator for tapestry the following decisions may be taken.
1) Let only define menu with id that indicate the menu tree as in the following example.

menuA
  menuA.item1
    menuA.item1.subitem01
  menuA.item2
    menuA.item2.subitem01
    menuA.item2.subitem02
    menuA.item2.subitem03

2) definining a configuration with a limited nesting set (say 5). My worry is that this may confuse the user

What would you suggest ?

kiuma

On 4/2/07, Knut Wannheden <knut.wannheden@...> wrote:
Kiuma,

In your schema (at least in the snippet you included) there are only
two nesting levels defined whereas in the example you've got 3 nested
<item> elements. And as you probably know HiveMind doesn't allow
recursive Schema definitions.

HTH,

--knut

On 3/31/07, Andrea Chiumenti < kiuma72@...> wrote:

> Hello I'd like to create something similar to this:
>
> <item id="a">
>     <item id="a-1">
>         <item id="a-1-1"/>
>         <item id="a-1-2"/>
>         <item id="a-1-3"/>
>     </item>
>     <item id="a-2">
>         <item id="a-2-1"/>
>         <item id="a-2-2"/>
>     </item>
>  </item>
>
> I've defined this, but It's wrong:
>        <element name="item">
>             <attribute name="id" required="true"/>
>             <attribute name="parentId" required="false"/>
>             <attribute name="order" required="false"/>
>             <attribute name="label" required="false"/>
>             <element name="item">
>                 <rules>
>                     <invoke-parent method="addNode"/>
>                 </rules>
>             </element>
>             <conversion class="MyItem" />
>         </element>
>
> Can someone please tell me how to do ?
>
> Thanks,
> kiuma
>
>