Hi,
I'm trying to build a XML Schema for XMLs like that:
- <book>
-
<title>...</title>
-
<chapter>...</chapter>
-
<chapter>...</chapter>
-
<chapter>...</chapter>
-
<author>...</autor>
-
</book>
or like that
- <book>
-
<title>...</title>
-
<author>...</autor>
-
<chapter>...</chapter>
-
<chapter>...</chapter>
-
<chapter>...</chapter>
-
</book>
I mean, inside <book> there can be only one <title> (minOccurs=0, maxOccurs=1) and one <author> (minOccurs=0, maxOccurs=1) and many <chapter> (minOccurs=0, maxOccurs=unbounded), but combining them in any order (although all the <chapter>s could be together).
My first thoughts were using <xs:all>, but the problem is that <xs:all> only allows elements with maxOccurs=1, so it doesn't fit with <chapter> (that has maxOccurs=unboonded).
Anybody knows a solution or workaround? 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
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.