W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2003

RE: XML Schema for multiple elements in arbitrary order

From: Colin Mackenzie <colin@elecmc.com>
Date: Thu, 3 Jul 2003 09:51:34 +0100
To: "Hans-Werner Bartels" <bartelh@itereu.de>, <xmlschema-dev@w3.org>
Message-ID: <PJEOKNCGPHICMMDPMNAJIELACHAA.colin@elecmc.com>
normally this is done with a repeating choice

<xs:complexType name="p" mixed="true">
 <xs:choice minOccurs="0" maxOccurs="unbounded">
  <xs:element name="u"/>
  <xs:element name="b"/>
 </xs:choice>
</xs:complexType>

I have left the defintion of u and b as an exercise for the user..

Colin


  -----Original Message-----
  From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]On
Behalf Of Hans-Werner Bartels
  Sent: 03 July 2003 08:26
  To: xmlschema-dev@w3.org
  Subject: XML Schema for multiple elements in arbitrary order


  I am wonder ing if XML Schema can be used to decribe XML data structures
with elements which have at least 2 different child elements which may occur
more than once in arbitrary order. To give an example from XHMTL:

  1. version of a <p> element:
  <p>This is a <b>paragraph</b> with <b>bold</> and
<u>underlined</u>content. It seems <u>impossible</u> to properly decribe
this in XML schema.</p>

  2. version of a <p> element
  <p>This is a <u>paragraph</u> with <b>bold</> and
<u>underlined</u>content. It seems <u>impossible</u> to properly decribe
this in XML schema.</p>

  My problem is the the <xsd:sequence> tags would request a knowledge of the
exact sequence of <b> and <u> tags which is impossible. The only way would
be to use the <all> tag, but then I am only allowed to use 1 occurance of
<b> or <u> which seems to be an unacceptable restriction. Or I can use the
<xsd:any> tag but then validation becomes meaningless.

  Am I missing something or is this a flaw in XML Schema?






  Hans-Werner Bartels                            Phone: +49 89 3299 4173
  ITER Garching JWS                             Fax:     +49 89 3299 4313
  Boltzmannstr. 2                                    e-mail:
bartelh@merlin.itereu.de
  85748 Garching
  Germany
Received on Thursday, 3 July 2003 05:09:15 GMT

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