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"
*    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"
*        </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>*

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,

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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:20 UTC