W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: Question about complexType with unordered child elements with at least one child element

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Thu, 21 Jun 2001 11:28:55 +0200
Message-ID: <3B31BE57.FF6D5A35@dyomedea.com>
To: xmlschema-dev@w3.org
Eric van der Vlist wrote:
> 
> "Anna A. Yacubovitch" wrote:
> >
> > Hello!
> > I need some help.
> > I need a type that allows any order of child elements, every element can
> > appear no more than a single time.
> .../...
> > I need at least one child element.
> 
> I don't think you can capture this with W3C XML Schema...

Sorry, I was too harsh with W3C XML Schema, there is a long and verbose
possibility that is to describe all the possibilities.

For instance (with 2 elements):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
  <xs:element name="ApplicationRequest">
    <xs:complexType>
      <xs:choice>
	<xs:sequence>
         <xs:element name="PermissionRequestSet" type="xs:string" />
         <xs:element name="LocationRequestSet" type="xs:string"/>
	</xs:sequence>
	<xs:sequence>
         <xs:element name="LocationRequestSet" type="xs:string"/>
         <xs:element name="PermissionRequestSet" type="xs:string" />
	</xs:sequence>
        <xs:element name="PermissionRequestSet" type="xs:string" />
        <xs:element name="LocationRequestSet" type="xs:string"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

I let you add the 5 remaining elements ;=) .

Eric

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Thursday, 21 June 2001 05:29:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT