Re: optional, but at least one required

Marie Bilde Rasmussen writes:

> I guess some of you will now tell me to use Relax NG instead. 
> Unfortunatley, I don't have that option. So I am not asking for
> an answer or solution,  I would just like to hear some opinions
> on the issues. 

If you're asking: "why did W3C XML Schema adopt the UPA constraint?", I 
can tell you that it was and remains a very contentious issue.  At the 
risk of oversimplifying or perhaps entirely mangling the analysis, some of 
the pros and cons are:

UPA "Advantages": 
a) makes it easier for database-mapping, programming language binding, 
user-interface generation tools, etc. to statically determine what a 
schema will and won't accept.  In certain respects, UPA restricts schemas 
to things that are relatively easier to bind than what you get without 
UPA.
b) makes it easier to apply the deterministic validation algorithms, such 
as those that were used in many XML 1.0 validators

UPA "Disadvantages"
a) as you've seen, makes certain schemas impossible to write, and some 
others difficult to write in a straightforward way
b) confusing to users
c) Technologies like RelaxNG are closed under intersection, union and 
difference.  E.g. you can always write a schema that accepts exactly the 
union of the documents accepted by 2 or more other schemas.  I'm not 100% 
sure, but I'm fairly confident that adopting UPA is at odds with achieving 
such closure.  Closure is desirable for many reasons.  Most obviously, if 
you do a query to retrieve two classes of documents, conforming to S1 and 
S2 respectively, then closure ensures that you can write a schema that 
tightly bounds the results of the query.
d) Seems ugly to some people

As I say, I've probably missed some important points, but it does remain a 
point of active debate.  (BTW: don't infer from the length of the above 
lists that I'm against UPA;  I've been in favor of it, and it's 
sufficiently important to our database implementors among others that I 
remain in favor.  I'm just trying to present the pros and cons as I 
understand them.  I do think it's in some ways a tough call.)

Noah





--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------

Received on Tuesday, 16 October 2007 23:20:32 UTC