- From: Eric van der Vlist <vdv@dyomedea.com>
- Date: 11 May 2002 16:59:13 +0200
- To: Raymond Wong <raywong@topsoft.com.hk>
- Cc: xmlschema-dev@w3.org
Hi, On Tue, 2002-05-07 at 04:18, Raymond Wong wrote: > Hi, > I'm new to xml and am trying to create a dtd. I want to know is it possible to share the same child element with different child elements by two parent elements. If yes, Any solution? > > Case: > > DTD: > <!Element A (child) > > <!Element B (child) > > <!Element child (elt1, (elt2 | elt3)) > You need to mix xs:sequence (equivalent to "," in DTDs) and xs:choice (equivalent to "|" in DTDs): <xs:element name="child"> <xs:complexType> <xs:sequence> <xs:element ref="elt1"/> <xs:choice> <xs:element ref="elt2"/> <xs:element ref="elt3"/> </xs:choice> </xs:sequence> </xs:complexType> </xs:element> You can then use a reference to element "child" in the definitions of your elements A and B (and need to define the "elti"s as well). Hope this helps. Eric -- See you in Barcelona. http://www.xmleurope.com/2002/schedule.asp ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com http://xsltunit.org http://4xt.org http://examplotron.org ------------------------------------------------------------------------
Received on Saturday, 11 May 2002 10:59:17 UTC