Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


mixing childs in any order and any quantity

From: =?iso-8859-1?Q?Ferm=EDn_Gal=E1n_M=E1rquez?= <fermin.galan@----.-->
To: <xmlschema-dev@--.--->
Date: 10/6/2006 1:55:00 PM
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=EDn Gal=E1n M=E1rquez
CTTC - Centre Tecnol=F2gic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Ol=EDmpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +34 93 645 29 12 
Fax : +34 93 645 29 01
Email address: fermin.galan@c... 

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.



From gkholman@C... Fri Oct 06 14:18:54 2006
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent