- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Fri, 14 Mar 2003 12:29:48 +0000
- To: Sam Carleton <sam@linux-info.net>
- CC: xmlschema-dev <xmlschema-dev@w3.org>
Hi Sam, > I am trying to define a element that contains text and can > optionally contain one or more <b> elements and/or <i> elements in > any order. How do I define that? This is what I have so far: > > <xs:complexType name="stringType" mixed="true"> > <xs:all minOccurs="0"> > <xs:element ref="b"/> > <xs:element ref="i"/> > </xs:all> > </xs:complexType> > <xs:element name="i" type="xs:string"/> > <xs:element name="b" type="xs:string"/> You can't use <xs:all> for repeatable elements, but a repeating <xs:choice> works nicely. Try: <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="b" /> <xs:element ref="i" /> </xs:choice> for zero to unbounded (as per the subject line of your email) or: <xs:choice maxOccurs="unbounded"> <xs:element ref="b" /> <xs:element ref="i" /> </xs:choice> for one to unbounded (as per the text of your email). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Friday, 14 March 2003 07:30:01 UTC