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

Re: allowing zero to unbounded elements in any order?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 14 Mar 2003 18:37:22 +0000
Message-ID: <156541085740.20030314183722@jenitennison.com>
To: "Scott, Michael Gordon" <Michael.Gordon.Scott@kla-tencor.com>
CC: Sam Carleton <sam@linux-info.net>, xmlschema-dev <xmlschema-dev@w3.org>

Hi Michael,

> I had a case where I needed to do this as well. Your solution is
> intriguing, but I'm confused. What if I wanted a list similar to :
>
>         <A>
>                 <B/>
>                 <C/>
>                 <D/>
>                 <E/>
>                 <C/>
>         </A>
>
> Where I could have multiple copies of <C/>, but I wanted to allow B,
> C, D, and E to be any order. After a few days of trying to
> accomplish that, I gave up, and used <xs:sequence> instead, and
> force my users to live with order.

Yes, that's one of the ways to handle the problem. If you were kind,
you might supply a simple transformation that would generate the order
you've specified in the schema from the order that they've used in
their document. The other ways are:

  - create a content model that tediously spells out the possible
    alternative orderings

  - use a loose content model in which everything can repeat any
    number of times and then use Schematron (or something similar) to
    add the constraint that B, D and E can appear only once

  - add a wrapper around the repeatable C element, so that you can use
    <xs:all> to get B, C, D and E to appear in any order
    
  - switch to RELAX NG, where it's easy to express using interleave:
    (B & C+ & D & E)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 14 March 2003 13:37:37 GMT

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