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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespaces, W3C XML Schema (was Re: ANN: SAX Filters forNamespaceProcessing)

It seems to me that the objections to local elements mostly have to do with the notion of typing; e.g. given a name and possibly a namespace but no positional context, developers want to be able to assign a type to that element. I mostly agree with this. 

However, I think I part company with the majority when it comes to the question of just what the purpose of a schema is. I think all the wailing and gnashing of teeth about unique typing misses the real point of schemas, and what developers are actually doing with them. Schemas are not about assigning types to elements. The APIs for that aren't even invented yet. Schemas are about *validation*. Put another way, schemas are a declarative language for expressing constraints on XML documents. In this case, being able to assign different constraints to elements with the same type in different contexts is crucial.

Conside a schema for XML-RPC for example. In particular consider Example 2.14 in Processing XML with Java, http://www.ibiblio.org/xml/books/xmljava/chapters/ch02s05.html#d0e2705
XML-RPC defines a struct element, which has a certain natural type. It is essentially a list of name-value pairs, as in any C program. However, a struct element that happens to be the value of a fault element is much more constrained than an arbitrary struct. It must have exactly two members, which must be named faultCode and faultString and must have the types int and string. Although the struct element has a global type, it has additional local constraints, which in fact can only be partially expressed in schemas.

I am concerned that the theoretical use of schemas for typing is overriding their practical use for constraint checking. Very few people are actually using schemas for typing. Instead they're being used for validation. In validation, we need local types (if not necessarily unqualified local types) because the W3C XML Schema Language confuses the two separate issues of typing and constraints checking, especially when it comes to complex types. I don't want to see any prohibition on local types enshrined as a best practice, or otherwise deprecated. 


| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |