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] typing and markup (was Re: [xml-dev] XQuery types)

[ Lists Home | Date Index | Thread Index ]

Jonathan Robie wrote:

> Frankly, I think much of this is because of the level of the discussion.
> Suppose you try to multiply an integer times a URI. Do you want that error
> to be caught? Suppose you want a sorted list of numbers - do you want to
> sort them numerically rather than lexically? If so, types are good. Yes,
> whoever implemented the system had to think to make that happen. We have
> descriptions of the thinking implementors will have to do.
> Has the strong static typing of Java gotten in your way as a programmer?

We are talking about two different types of typing: the first roughly
corresponds to XML Schema simple types and involves the mapping of a lexical
to value representation i.e. the string "10" to the number 10.

The second type of type roughtly corresponds to XML Schema complex types and
is perhaps more apropos to XML in its lexical form.

The types of inferences that one can draw knowing that two entities are
numbers vs. knowing that two entities are XML elements conforming to a
particular schema particle are different. All the examples seem to focus on
the former, binary, datatype usage and Simon is right to complain, XML is
after all a lexical form.

The latter is more apropos to, for example, XPath/XSLT processing where an
XPath expression is exactly a class specifier -- it selects a _set of nodes_
that match the XPath pattern. So an XSLT template is, then, a mechanism to
apply a function to a set of nodes having a given class -- the class
specifier is the match pattern.

A regular expression does exactly the same thing, it specifies a class of
lexical tokens that are constrained to match the regex. An EBNF generated
parser e.g. via JavaCC or ANTLR is roughly analogous to an XSLT process,
just for text rather than XML -- in boths cases, however, there must exist a
pattern matcher, which is a string classifier, that selects strings on the
basis of whether they match the given pattern i.e. belong to the described
set of tokens.

The advantage of having an XQuery like type _heirarchy_ as opposed to simple
type specifiers i.e. XPath 1.0 patterns, is that, as Jonathan Robie points
out, one can make additional inferences about the particular classes and
ways that the classes are combined. For example suppose we have:

intersectionOf( intersectionOf(A,B), intersectionOf(C,D) )

we know that this is the same as:

insersectionOf( A,B,C,D )

and manipulating classes in such ways can be very useful.





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

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