AnsweredAssumed Answered

XSD - recursion problem

Question asked by kwantm on Sep 18, 2007
Latest reply on Dec 10, 2009 by kirk
Hi,

I am building a dynamic menu component. I am using webforms to maintain the menu. I have seen the examples in various war files and on the forum here.

What I see there is a limited depth XSD file representing a menu. This is not what I want to do. What I want is a unlimited menu depth.

I have coded my XSd as follows:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.wowww.nl/navigation"
        xmlns:nav="http://www.wowww.nl/navigation"
        elementFormDefault="qualified">
       
   <xs:complexType name="link">
       <xs:sequence>
         <xs:element name="path" type="xs:anyURI" />
       </xs:sequence>
   </xs:complexType>

   <xs:complexType name="menuItem">
      <xs:sequence>
         <xs:element name="name" type="xs:normalizedString" />
         <xs:element name="description" type="xs:normalizedString"/>
         <xs:element name="sub_channel" type="nav:menuItem" minOccurs="0" maxOccurs="unbounded"/>
         <xs:element name="content_link" type="nav:link" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>   
   </xs:complexType>
       
   <xs:element name="navigation">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="name" type="xs:normalizedString" />
            <xs:element name="description" type="xs:normalizedString"/>
            <xs:element name="main_channel" type="nav:menuItem" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="content_link" type="nav:link" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

The syntax is correct and I can use this outside Alfresco. But when I use this in Alfresco and try to create content based upon this XSD (In the create webcontent wizard insite a webproject), I get a
java.lang.StackOverflowError. I have seen in the log that Alfresco tries to pre-create all elements.

Have I stumbled on a bug or must I code my XSD differently to support my idear of a unlimited menu structure?


Kind regards,

Marc
http://www.wowww.nl

Outcomes