OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] [Summary] Constrain the Number of Occurrences of Elementsi

[ Lists Home | Date Index | Thread Index ]

hi Roger,

i'm somewhat astonished : if i need to express that the number of books 
mustn't exceed 30000, then i will really use <element name="Book" 
maxOccurs="30000"> because W3C Schema specification allow it ; if the 
schema engine is inefficient to process it without causing out-of-memory 
errors, then i will change the engine or report a bug

Roger L. Costello wrote:
> There is a technical problem with setting maxOccurs="30000". Michael Kay 
> nicely summarizes the problem: "the classical algorithms for turning 
> grammars into finite state machines produce very inefficient machines 
> when there are occurrence limits that are large but finite. Many schema 
> processors break or consume seriously large amounts of memory if you 
> specify a maxOccurs value (other than unbounded) that's greater than a 
> couple of hundred." In other words, a Schema validator will choke if you 
> specify maxOccurs="30000".

i have another conclusion : if this algorithm is inefficient with large 
values, why not switch to a more suitable one for small values ?

what is the challenge ? to implement classical algorithms that apply 
theory of computation, or to make relyable softwares ?
be pragmatic !

> <element name="Bookstore">
>     <complexType>
>         <sequence>
>             <element name="Book" type="..." *maxOccurs="unbounded"*>
>                 *<schematron:assert test="count(Book) <= 30000"/>*
>             </element>
>         </sequence>
>     </complexType>
> </element>
> Comments?

using Schematron to express assertions that W3C Schema can't is 
certainly a good thing ; using Schematron as a hack to correct 
inefficiency of a schema engine is a non-sense (except if you bought one 
that you must use etc)


           (. .)
|   Philippe Poulard    |


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS