W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Re: Nested Elements in Schema

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed, 17 Oct 2001 21:42:30 +0200
Message-ID: <3BCDDF26.1030300@dyomedea.com>
To: kbisht@citadon.com
Cc: xmlschema-dev@w3.org
Hi,

kbisht@citadon.com wrote:

> Hi,
> 
> How can i nest a element say "forwardcomment" inside another element called
> "forwardcomment" both being of the same type.
> 
> Here is the kind of XML tree i wish to create 
> 
> <BaseComment>
> 	<responsecomment>ZZZZ</responsecomment>
> 	<forwardcomment>
> 		XXX
> 		<responsecomment>ZZZZ</responsecomment>
> 		<forwardcomment>
> 		XXX
> 			<responsecomment>ZZZZ</responsecomment>
> 		</forwardcomment>
> 
> 	</forwardcomment>
> </BaseComment>
> 
> The nesting of the element "forwardcomment" is to be indefinite.
> 
> Is it possible at all? 


Yes, definitely.

To do so, the simplest is to create a global definition for 
"forwardcomment" and to reference it when you need it... something such as:

<xs:element name="forwardcomment">
  <xs:complexType mixed="true">
   <xs:sequence>
    <xs:element name="responsecomment" type="xs:string"/>
    <xs:element ref="forwardcomment"/>
   </xs:sequence>
  </xs:complexType>
</xs:element>


> Any pointers or help would be highly appreciated.


http://www.xml.com/pub/a/2000/11/29/schemas/part1.html

Hope this helps.

Eric


> 
> Regards,
> kartik
> 


-- 
Rendez-vous  Paris pour le Forum XML.
                    http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Wednesday, 17 October 2001 15:42:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:24 GMT