Re: allowing zero to unbounded elements in any order?

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 UTC