- From: Fermín Galán Márquez <fermin.galan@cttc.es>
- Date: Fri, 6 Oct 2006 20:51:20 +0200
- To: <xmlschema-dev@w3.org>
Hi,
Thank you very much to all who have provided me with feedback and support
(especially to Anne for her XMLSchema fragment :)!
However, I see there isn't a simple workaround for an arbitrary number of
childs of <book>. When the number of childs of <book> increases (in the
example that I describe in my first mail only has three -<author>, <title>
and <chapter>- to keep the description simple, but my real application has
14 childs, 6 of them multiple -like <chapter>), complexity increases
exponentially... A similar problem happends with DTD.
Therefore, I'm afraid I will have to use "grouping elements" to keep the
XMLSchema simple, that is, adding an additional "nesting step" in <book>.
Best regards,
--------------------
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Olímpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +34 93 645 29 12
Fax : +34 93 645 29 01
Email address: fermin.galan@cttc.es
-----Mensaje original-----
De: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] En
nombre de Fermín Galán Márquez
Enviado el: viernes, 06 de octubre de 2006 11:55
Para: xmlschema-dev@w3.org
Asunto: mixing childs in any order and any quantity
Hi,
I'm trying to define using XML Schema a element which content mixes several
elements, some of then multiple, that can come in any order and I wonder if
even this is possible.
Let me clarify with a example. Consider a <book> element whose content can
be up to one <title> (minOccurs=0, maxOccurs=1), up to one <author>
(minOccurs=0, maxOccurs=1) and many <chapter> (minOccurs=0,
maxOccurs=unbounded) that comes together, but combining child tags in any
order.
Examples:
<book>
<title>...</title>
<chapter>...</chapter>
<chapter>...</chapter>
<chapter>...</chapter>
<author>...</autor>
</book>
<book>
<title>...</title>
<author>...</autor>
<chapter>...</chapter>
<chapter>...</chapter>
<chapter>...</chapter>
</book>
How would be the XML Schema definition for such <book> element, please?
Firstly, I though using <xs:all>, but the problem is that it only allows
elements with maxOccurs=1, so it doesn't fit with <chapter> (that has
maxOccurs=unbounded).
Anybody knows a solution or workaround, please? I'm getting crazy reviewing
the XML Schema reference for some solution, but I'm not finding anything ..
Please, any help is very welcome!
Regards,
--------------------
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya Parc Mediterrani
de la Tecnologia, Av. del Canal Olímpic s/n, 08860 Castelldefels, Spain Room
1.02 Tel : +34 93 645 29 12 Fax : +34 93 645 29 01 Email address:
fermin.galan@cttc.es
PD. Of course I could do something like:
<book>
<title>...</title>
<author>...</autor>
<chapters>
<chapter>...</chapter>
<chapter>...</chapter>
<chapter>...</chapter>
</chapters>
</book>
and define <book> as a <xs:all> of <title>, <author> and <chapters>, but I
would like to solve the problem without adding the <chapters> "grouping"
element.
Received on Friday, 6 October 2006 18:51:50 UTC