[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Namespaces,W3C XML Schema (was Re: ANN: SAX FiltersforNamespaceProcessing)
- From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
- To: Xml-Dev <xml-dev@lists.xml.org>
- Date: Thu, 23 Aug 2001 09:40:12 -0400
At 8:41 AM +0100 8/23/01, Francis Norton wrote:
>Elliotte Rusty Harold wrote:
>> Why would local types make life harder for general purpose processors? If a presentation or editing tool is presented with a local restriction of a type, why can't it work with that? If it can't work with that, why can't it use an editor for the base type?
>
>Hi, that was me. I may be misunderstanding your point - two
>locally-typed elements in the same schema may have the same name but
>totally different types, with no relationship by restriction to anything
>in common, or at all (apart from our old friend the ur-type).
>
I still don't see the problem. Assume we have two elements named FOO and FOO. FOO in context 1 has type Str32 (a string with exactly 32 characters). FOO in context2 however, has type int. Both are passed to a processing layer through some PSVI aware API. When the processor receives FOO it is told the name and type of the element. It dispatches appropriately for the type. It doesn't matter which type it is. FOO Str32s are dispatched to the FOO Str32 handler. FOO ints are dispatched to the FOO int handler. Where's the problem?
In fact, this even reminds me a little of method overloading where you often do have two methods with the same names and even the same argument lists but different argument types. For instance here's one I wrote recently:
public XIncludeFilter(String url)
public XIncludeFilter(URL url)
There may be a problem for non-PSVI aware APIs, so I wouldn't necessarily recommend that applications be designed like this. However, even in that case, there's likely extra-context information (like what the parent element is) that allows the program to sort out the details. In fact, the only real objection I see to this is that it's more confusing for humans to sort out what's going on, but this is nothing to a computer.
--
+-----------------------+------------------------+-------------------+
| 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/ |
+----------------------------------+---------------------------------+