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

Re: Constrain the Number of Occurrences of Elements in your XM


xm contact numbers
On Fri, Aug 05, 2005 at 02:38:23PM -0400, Roger L. Costello wrote:
> I agree that recursion can be extremely useful.  In fact, recursion is fun!
>  
> However, "runaway recursion" is not useful, nor is it fun.

Recursion in a schema is not "runaway".  Rather, it is merely
not artificially constraining.

Others have already pointed out that limits of, say, 30,000 or so,
can bring a schema processor to its knees.  C. Michael Sperberg-McQueen
did indeed present this week at Extreme Markup an alternate
implementation strategy which can be more memory-efficient, but
of course it may take years before we see this in shipping software.

I also saw at Extreme Markup someone editing a document that had
an element with tens of thousands of children.  This is not unusual
when dealing with dictionaries or encyclopedias, even if you have
a container for all entries starting with the same letter.

If most people used upper limits of, say, 3,000 elements per
container, software would probably start to take advantage of
the restriction (otherwise there's not much benefit), and then
documents with more than that many children would start to
lose out -- interoperability would suffer.

This was actually an interoperability problem with SGML -- by
default, element names were limited to 8 characers.  Some
programs pre-allocated 8 bytes per name (a problem with UTF-16!)
and others simply didn't cope with element names longer than 8.

Use recursion when it is appropriate.  Use unbounded whenever there
is no natural problem-domain-imposed limit -- although you may
have to take a whole system into account when considering this,
and be willing to impose a limit where, for example, a database
prevents text fields from being longer than 64 KBytes or whatever.

But do it based on practical needs, or based on a problem domain.

If you restrict telephone numbers to nine digits, people in the
USA won't be able to enter their phone numbers.  If you allow ten
digits, people in the UK might not be able to enter the full number.
If you forget to allow space for it, how do people ask for
"extension 301" when calling?  If you restrict a postal code to
5 digits, people living outside the US, where postal codes often
contain letters, might not be able to do business with you.  If you
don't allow a chapter to contain more than 30 paragraphs, or a book
to have more than twenty chapters, don't try to process War and
Peace or the Bible.  Do I need to go on?  I hope not! :-)

Best,

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/   http://fromoldbooks.org/

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.