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

Query reg Recursion

From: kamal krishna <kvsk.kamal@gmail.com>
Date: Thu, 9 Feb 2012 18:17:44 +1100
Message-ID: <CAF8YKTN1sn_L+seYXd6nq_oAuWrQdKHXK7ThUnJAYYwyWL6e7g@mail.gmail.com>
To: xmlschema-dev@w3.org
hi team,

I was wondering if you could help me in understanding and designing the
recursion in the XSD. My question is regarding defining the max depth of
the recursion at the time of definition of the schema. For ex, if I refer
to a recursive element, I want to define the number of times the element
can be called recursively.

This way I can avoid infinite recursion or creating duplicate objects for
calling an object within itself. Please find below the sample schema that I
prepared to explain this issue:

*<?xml version="1.0" encoding="UTF-8"?>*
*<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"*
*    attributeFormDefault="unqualified">*
*
*
*    <xsd:element name="Ety" type="Entity"/>*
*    <xsd:complexType name="Entity">*
*        <xsd:sequence>*
*            <xsd:element name="A" type="xsd:string" minOccurs="0"/>*
*            <xsd:element name="B" type="xsd:string" minOccurs="0"/>*
*            <xsd:element name="C" type="xsd:string" minOccurs="0"/>*
*            <xsd:element name="EntityAssoc" type="EntityAssoc"
minOccurs="0"/>*
*        </xsd:sequence>*
*    </xsd:complexType>*
*    <xsd:complexType name="EntityAssoc">*
*        <xsd:sequence>*
*            <xsd:element name="C" type="xsd:string" minOccurs="0"/>*
*            <xsd:element name="D" type="xsd:string" minOccurs="0"/>*
*            <xsd:element type="Entity" name="Entity" minOccurs="0"/>*
*        </xsd:sequence>*
*    </xsd:complexType>*
*</xsd:schema>*

I want only one iteration of the EntityAssoc within Entity. Could you
please let me know if this is possible?

Thanks a lot for your help,

Regards,
Krishna Kamal
Received on Friday, 10 February 2012 08:05:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 10 February 2012 08:05:33 GMT