Lists Home |
Date Index |
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! :-)
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/