W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2012

Is this the complete list of ways to create recursion in XML Schemas?

From: Costello, Roger L. <costello@mitre.org>
Date: Sat, 25 Aug 2012 15:10:18 +0000
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <B5FEE00B53CF054AA8439027E8FE17751E6304D6@IMCMBX04.MITRE.ORG>
Hi Folks,

One way to create recursion in XML Schemas is with a recursive element reference, e.g.,

    <xsd:element name="Section" type="SectionType" />
    
    <xsd:complexType name="SectionType">
        <xsd:sequence>
            <xsd:element name="Title" type="xsd:string" />
            <xsd:element ref="Section"  minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
    

A second way to create recursion in XML Schemas is with a recursive complexType reference, e.g.,

    <xsd:element name="Section" type="SectionType" />
    
    <xsd:complexType name="SectionType">
        <xsd:sequence>
            <xsd:element name="Title" type="xsd:string" />
            <xsd:element name="Section" type="SectionType" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>


A third way to create recursion in XML Schemas is with a recursive include reference, e.g.,

-------------------------
        A.xsd
-------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    
    <xs:include schemaLocation="B.xsd" />

</xs:schema>

-------------------------
        B.xsd
-------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    
    <xs:include schemaLocation="A.xsd" />

</xs:schema>


Is that the complete list? Are there any other ways to create recursion in XML Schemas?

/Roger
Received on Saturday, 25 August 2012 15:10:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 25 August 2012 15:10:57 GMT