- From: by way of <alex@aoi.dyndns.org>
- Date: Mon, 07 Jul 2003 14:48:59 -0600
- To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
- Message-Id: <5.1.0.14.1.20030707144855.02179ad8@localhost>
At present, particles within <all> must have a maxOccurs of 0 or 1, and <all> may not contain <group>, <choice>, <sequence>, or <any>. I feel this is excessively restrictive. Consider the following document snippet: <some-element xmlns="http://example.com/some/namespace"> <foo /> <baz /> <bar> <one /> <two /> </bar> <xyzzy xmlns="http://example.com/some/other/namespace" /> <baz /> </some-element> Now, say <some-element> must contain <foo>, optionally <bar>, and any number of <baz>, but we want to allow these elements to occur in any order. Also say we want to allow any elements with other namespaces to be freely interspersed among these elements. I would think to put together an XML Schema <element> like so: <xs:element name="some-element"> <xs:complexType><xs:all> <xs:element ref="foo" /> <xs:element ref="bar" minOccurs="0" /> <xs:element ref="baz" minOccurs="0" maxOccurs="unbounded" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> </xs:all></xs:complexType> </xs:element> Surprise! That doesn't work. There's <choice>, but that doesn't allow us to specify that <foo> is mandatory, and <bar> may not occur more than once, while at the same time allowing any number of <baz> and elements from other namespaces. I'm probably missing something, but it doesn't look like XML Schema 1.0 allows for describing that without something absurd like this: <xs:element name="some-element"> <xs:complexType> <xs:choice> <xs:sequence> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> <xs:element ref="foo" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> <xs:element ref="bar" minOccurs="0" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> <xs:element ref="baz" minOccurs="0" maxOccurs="unbounded" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> </xs:sequence> <xs:sequence> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> <xs:element ref="bar" minOccurs="0" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> <xs:element ref="foo" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> <xs:element ref="baz" minOccurs="0" maxOccurs="unbounded" /> <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="skip" /> </xs:sequence> ...... </xs:choice> </xs:complexType> </xs:element> Not only is this ugly even in this small example, but as the size of this construct increases exponentially with the number of described child elements of <some-element>, it is not scalable, either. The real-world schema I've been working on would probably be hundreds of megabytes in size. Alex.
Attachments
- text/plain attachment: _Moderator_Action__all_is_too
Received on Monday, 7 July 2003 16:49:47 UTC