The usage of <xs:choice maxOccurs="unbounded">

Discussion in 'XML' started by mavis, Jun 1, 2006.

  1. mavis

    mavis Guest

    The usage of <xs:choice maxOccurs="unbounded">

    When we want to define a set of elements that could be in any order and
    with any occurences (0-unbounded), we can use <xs:choice
    maxOccurs="unbounded">

    But I alway think that is not a good schema definition for XML files,
    and it must influence the writing and reading performance of these set
    of elements if there are large amounts of sub-elements. We can imagine
    that the retrieval of any single element will need to loop through all
    the subelements.......

    Any advices of this will be highly appreciated!!
     
    mavis, Jun 1, 2006
    #1
    1. Advertising

  2. mavis wrote:
    > But I alway think that is not a good schema definition for XML files,
    > and it must influence the writing and reading performance of these set
    > of elements if there are large amounts of sub-elements.


    If there are many sub-elements, it takes more time to read them than if
    there are only a few. The use of maxOccurs="unbounded" (or simply not
    specifying maxOccurs at all) doesn't change that. If anything, unbounded
    might reduce parsing cost because there's no need to maintain a counter
    and check whether it has been exceeded.

    You're wasting time trying to micro-optimize the wrong things.



    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jun 1, 2006
    #2
    1. Advertising

  3. mavis

    mavis Guest

    I guess whether it is in order does make difference..


    Joe Kesselman wrote:
    > mavis wrote:
    > > But I alway think that is not a good schema definition for XML files,
    > > and it must influence the writing and reading performance of these set
    > > of elements if there are large amounts of sub-elements.

    >
    > If there are many sub-elements, it takes more time to read them than if
    > there are only a few. The use of maxOccurs="unbounded" (or simply not
    > specifying maxOccurs at all) doesn't change that. If anything, unbounded
    > might reduce parsing cost because there's no need to maintain a counter
    > and check whether it has been exceeded.
    >
    > You're wasting time trying to micro-optimize the wrong things.
    >
    >
    >
    > --
    > () ASCII Ribbon Campaign | Joe Kesselman
    > /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    mavis, Jun 1, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mickey Segal
    Replies:
    0
    Views:
    899
    Mickey Segal
    Feb 2, 2004
  2. Mavis
    Replies:
    0
    Views:
    434
    Mavis
    Jun 1, 2006
  3. Replies:
    2
    Views:
    2,162
    Joe Kesselman
    Jun 5, 2006
  4. Sebastian Stein

    About usage of maxOccurs

    Sebastian Stein, Aug 14, 2006, in forum: XML
    Replies:
    3
    Views:
    1,589
    Sebastian Stein
    Aug 15, 2006
  5. miles.jg
    Replies:
    16
    Views:
    885
    Alf P. Steinbach
    Nov 14, 2007
Loading...

Share This Page