W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2006

elements with different occurance limits

From: John Didion <johndidion@yahoo.com>
Date: Tue, 19 Sep 2006 09:37:30 -0700 (PDT)
Message-ID: <20060919163730.71687.qmail@web53105.mail.yahoo.com>
To: xmlschema-dev@w3.org

I have a complex type...let's call it Foo. Foo
potentially has five child elements:

A and B, each of which MUST appear once
C, D, and E, each of which MAY appear any number of
times, but one of which MUST appear at least once

My first instinct was to write this as an all:

<xs:all>
<xs:element name="A"/>
<xs:element name="B"/>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="C"/>
<xs:element name="D"/>
<xs:element name="E"/>
</xs:choice>
</xs:all>

But of cource, all doesn't allow any element to appear
more than once. I also tried writing this as a big
choice block, with sequences for each of the possible
ways these elements could be ordered, but the parser
complained about potential ambiguity.

Here is the element definition from the DTD that I'm
trying to convert to XSD:

<!ELEMENT MSGSETLIST (
( ( ( SIGNONMSGSET, PROFMSGSET ) | ( PROFMSGSET,
SIGNONMSGSET ) ), ( %MSGSETMACRO; )+ ) |
( ( ( SIGNONMSGSET, ( %MSGSETMACRO; )+, PROFMSGSET ) |
( PROFMSGSET, ( %MSGSETMACRO; )+, SIGNONMSGSET ) ), (
%MSGSETMACRO; )* ) |
( (%MSGSETMACRO;)+, ( ( SIGNONMSGSET, ( %MSGSETMACRO;
)*, PROFMSGSET ) |
( PROFMSGSET, ( %MSGSETMACRO; )*, SIGNONMSGSET ) ), (
%MSGSETMACRO; )* )
)>

Thanks in advance for your help!

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Received on Wednesday, 20 September 2006 03:06:59 GMT

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