You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Christopher Birkett <ch...@yahoo.com> on 2002/02/26 16:13:43 UTC

Cannot do any order and control the maxOccurs.

Hi,
I sent this summary of a major limitation of XML
Schemas 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

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org