Re: [XQueryX] 5 A Trivial Embedding of XQuery

On 1/15/04 3:30 AM, "Kay, Michael" <Michael.Kay@softwareag.com> wrote:
> What is specific to XQuery is that it uses a syntax which is very close
> to XML syntax but subtly different. In fact, very many well-formed
> XQuery queries are also well-formed XML documents, and in many cases
> putting something like
> 
> <foo>bar</foo>
> 
> will produce the same infoset whether you put it through an XQuery
> processor or through an XML parser. This means that the other cases,
> those where a query is a well-formed XML document but has different
> interpretation, are particularly pernicious.

The people who find this similarity pernicious ("they're so close!") must be
the same people who try in vain to reuse existing XPath 1.0 and XML 1.0
parsers to implement their XQuery compilers, even though the languages are
different already at the lexical level, because XQuery superficially seems
to contain XML and XPath as subsets (even though it doesn't, not really).


To attempt to serialize the XQuery <foo>bar</foo> as itself is, to be blunt,
stupid.  It's the same as thinking the operator + behaves the same in every
language that uses it, just because they all happen to use the same syntax
for it.  XQuery places different rules on its element constructors
(including things like implicit validation) than XML does, and you'd lose
those rules if you tried to treat the XQuery as literal XML verbatim.  And
as David pointed out, you run into all sorts of places where XQuery and XML
just don't have the same character content rules at the lexical level.


But again, this is just my $0.02.  I have that feeling of tilting at
windmills whenever I engage in these debates.

Michael

Received on Thursday, 15 January 2004 11:34:05 UTC