- 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>
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 UTC