[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
elements with different occurance limits

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

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.