yann said:
Hi,
I try to write a schema to validate this :
<F>
<L/><A/><B/><C/>
</F>
where
- L has to be present once and only once and at first place
- each of A,B,C have to be present once and only once but
not ordered ( ABC, BAC, CAB, ...)
In XML DTD notation, what you are asking for is
(L, ( (A, ((B,C) | (C, B)))
| (B, ((A,C) | (C, A)))
| (C, ((A,B) | (B, A)))))
This has a straightforward translation into any schema language
you might wish to use.
SGML DTDs allow you to write
(L, (A & B & C))
which is shorter and means the same thing.
There are a couple of reasons to think twice before you do this,
however, in addition to the fact that working out all possible
sequences is boring.
First, the content model you describe makes sense only when the
order of A, B, and C conveys significant information. If the
order conveys no information, then you might as well fix it:
(L, A, B, C)
Second, it seems odd that the ordering constraints among
siblings should change in mid-stream. Abstractly, it
looks as if your content model falls into two pieces:
the L, and then the A-B-C sequence. It might make sense
to model that fact directly. In SGML notation:
<!ELEMENT container (L, ABCseq) >
<!ELEMENT ABCseq (A & B & C) >
In this case, the definition of ABCseq can easily be translated
into an XML Schema all-group.
--C. M. Sperberg-McQueen
World Wide Web Consortium