W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

Cannot do any order and control the maxOccurs.

From: Christopher Birkett <christopherbirkett@yahoo.com>
Date: Tue, 26 Feb 2002 10:12:19 -0500 (EST)
Message-ID: <20020226151139.44967.qmail@web20008.mail.yahoo.com>
To: xmlschema-dev@w3.org
Hi,
I sent this summary of a major limitation of XML
Schema's to my boss.  If anyone knows how to get
around it please tell me.

XML Schema Limitation:
1.  You cannot specify any order and have some, but
not all, of the elements' frequency greater than one.
    a.  What I mean by this is that presently our
multivalued fields are represented by specifying the
element any many times as needed.
         Example:
         <App>
             <cn>Word</cn>
             <Extension>doc</Extension>
             <Extension>txt</Extension>
         </App>
         In this example, if we wanted to say that
<cn> can only appear once and <sw-AppExtension> can
appear as many times as needed, then we would have to
put a restriction on the order the elements come in. 
Meaning, we couldn't put <Extension> before <cn>.
 
         To almost get around this limitation (if we
want any order and control the frequency) we have 2
options:
         1)  We would have to declare <Extension> as
an XML Schema list type.  The problem with this list
type is that the delimiter is a space, so they don't
recommend using a list for strings.
         Example:
         <Extension>doc txt</Extension>
         As you can see one of our values for another
field might have a space in it.  We could use our own
delimiter, but then we wouldn't be following the
standard.
 
         2)  We could specify any order and any
frequency for all items (choice maxOccurs="unbounded")
which means they could do this:
              <swApp>
                 <cn>Word</cn>
                 <cn>Microsoft Word</cn>
                
<sw-AppExtension>doc</sw-AppExtension>
                
<sw-AppExtension>txt</sw-AppExtension>
             </swApp>
 
             This really isn't what we want because cn
should only be there once (it is not a multivalued
field).

If anyone knows of anyway to get around this please
let me know.

Thanks,
Chris

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com
Received on Wednesday, 27 February 2002 03:34:40 GMT

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