[opencms-dev] Recursive XSD?

Seth Foss seth.foss at lat-inc.net
Thu Jun 15 15:07:08 CEST 2006


I was experimenting with what you can and can't do in OpenCMS, and was wondering, could I create a recursive XSD without breaking opencms? 

Currently I have one XSD as follows:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
  <xsd:include schemaLocation="opencms://sites/default/Tests/MyOtherTest.xsd"/>
  <xsd:element name="MyTests" type="OpenCmsMyTests"/>
  <xsd:complexType name="OpenCmsMyTests">
    <xsd:sequence>
      <xsd:element name="MyTest" type="OpenCmsMyTest" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="OpenCmsMyTest">
    <xsd:sequence>
      <xsd:element name="String" type="OpenCmsString"/>
      <xsd:element name="StringPair" type="OpenCmsMyOtherTest"/>
    </xsd:sequence>
    <xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
  </xsd:complexType>
</xsd:schema>

and my recursive XSD:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
  <xsd:include schemaLocation="opencms://sites/default/Tests/MyOtherTest.xsd"/>
  <xsd:element name="MyOtherTests" type="OpenCmsMyOtherTests"/>
  <xsd:complexType name="OpenCmsMyOtherTests">
    <xsd:sequence>
      <xsd:element name="MyOtherTest" type="OpenCmsMyOtherTest" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="OpenCmsMyOtherTest">
    <xsd:sequence>
      <xsd:element name="String2" type="OpenCmsString"/>
      <xsd:element name="StringPairs" type="OpenCmsMyOtherTest" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
    <xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>
  </xsd:complexType>
</xsd:schema>

I've tried editing content based on the first XSD which calls the second, and I think it's throwing me into an infinite loop. Is there a way to set the default number of occurances or anything like that? Any thoughts would be appreciated, even negative ones ;-)



More information about the opencms-dev mailing list