Re: Nested Elements in Schema

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 UTC