[
Lists Home |
Date Index |
Thread Index
]
Vladimir Gapeyev wrote:
>
> On Thu, 13 Oct 2005, Mail wrote:
>
>> However, I don't think it is really that hard to extend XML further to
>> make it strong typed. XML was initially designed without Namespace,
>> and it is now patched with namespace and everyone is happy to accept it.
I second Amelia's laughter on this point.
> I think you idea of introducing datatypes as an add-on similar to
> namespaces (or xml:ID) can be carried out by adding a bit more semantics
> to the xsi:type attribute, and moving it from WXS to XML Core. An
> important thing, I believe, would be to provide a framework for defining
> datatype identifiers and declaring them on document nodes, but to leave
> actual definitions of the datatype identifiers, lexical and semantic
> spaces, outside the specification and in the hands of the users and
> organized user groups.
There's a complexity cost to any addition to the core. Even if the
proposal were all advantage and no disadvantage, it still might well not
be worth it. So far I don't see a compelling benefit to doing this.
> E.g. here is an example of a document that conforms to the hypothetical
> XML-with-datatypes:
>
> <?xml version='1.0'?>
> <order xmldt:currency="my:banks:currency:format"
> xmldt:date="http://www.w3.org/2001/XMLSchema/date"
> xmldt:text="http://www.standardsbody.org/xmld/1.0/pcdata"
This document is namespace malformed. You need to declare the xmldt prefix.
> - The document above is XML-conformant.
But not namespace conformant
> - The xmldt attribute is reserved by the "Datatype definitions for XML"
> specification.
It's not an attribute. It's a namespace prefix. Reserving these is
*BAD*. URIs matter. Prefixes don't. That's at the heart of namespaces.
That xml: is an exception is grandfathered in, and this causes major
problems for implementations.
> - In the root element, xmldt binds datatype URIs to short names. The
> URIs, as well as lexical and semantic spaces for values of the
> corresponding datatypes, are defined by user groups, or just agreed upon
> between two
> developers.
Why does this need to go into the core then? Why do such agreements need
a separate lexical space/ What's wrong with GIs?
> - On elements that carry datatype values, xmldt declares the datatype,
> by referring to a short name.
names would need to be prefixed and namespace qualified.
> - A conformant XML processor checks that all referenced types are
> declared, and passes information about the type to the application
> whenever a typed node is encountered.
Why would I want to do this? Most of the time I don't validate already.
> Notes / Questions:
>
> - It is possible for a conformant processor to pass the type information
> to the application by returning a parsed semantic value instead its raw
> lexical text -- according to the conventions established between the
> processor and the application.
Not in any current API; and probably not in any API if the type system
is extensible. I once tried to design a new version of SAX that could do
this just with schema types. I couldn't figure out how.
> - This offers datatypes only for elements, but not for attributes. Is
> this a big disadvantage?
Only in so far as types matter at all.
> - I suspect that the effect of this proposal can be achieved today via
> WXS xsi:type or notations, but this would still require one to use
> schemas, even in a project where the requirement is just to know
> datatypes at the leaves, but process the tree structure dynamically. Is
> such a requirement uncommon?
You can use xsi:type without pulling in a schema.
--
Elliotte Rusty Harold elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
|