[
Lists Home |
Date Index |
Thread Index
]
You don't say what schema language (or DTD?) you are working with. It is
cumbersome to express these constraints without order in DTD or XML
Schema. XML Schema's 'all' will not allow more than once. You would be
forced to write out the alternatives by hand. For example, for three
required elements a, b and c, without order.
(a,((b,c)|(c,b)))
|(b,((a,c)|(c,a)))
|(c,((a,b)|(b,a)))
(The DTD-style notation would need to be translated into the much
bulkier XML Schema syntax.)
When all of the alternatives are optional and some can be repeated, more
thought is required but the pattern is the same. For example, suppose a
can occur only once, b and c more than once.
((a,((b+,c*)|(c+,b*))?)
|(b,((a,c*)|(c+,a))?)
|(c,((a,b*)|(b+,a))?))?
Note that the number of subexpressions expands exponentially as the
number of subelements increases.
In RELAX NG, however, this would be trivial to write. The following is
in the RELAX NG compact syntax:
a? & b* & c*
Bob Foster
http://xmlbuddy.com/
Ben Ryan wrote:
> All,
> Apologises if this is the wrong list to post to. Please could
> someone advise if there is a more appropriate list.
>
> I am trying to model the following:
>
> An element has a number of subelements that are not ordered.
> All of these subelements are optional.
> Certain of the subelements can occur more than once.
> Ceratin of the subelements can only occur once.
>
> If I use a choice model I need to make it unbounded to allow the
> occurrence of more than one subelement.
> If I do this then all the subelements can occur more than once.
>
> I can work around this using sequence models but the standard am
> I following does not specify order.
>
> Any help would be appreciated.
>
> Regards,
> Ben
>
> ---------------------------------
> Dr Ben Ryan
> HLSI Software Development Manager
> University of Huddersfield
> Tel: 01484 473587
> E-mail: b.ryan@hud.ac.uk
> ---------------------------------
|