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

M

mavis

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!!
 
J

Joe Kesselman

mavis said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top