Re: [xml-dev] The use of XML syntax in XML Query

At 03:37 PM 1/3/2002 +0000, David Carlisle wrote:

> > The basic idea is that any construct in XQuery that looks like XML is a
> > constructor for the same construct.
>
>But it is not XML syntax it is just syntax that looks a bit like some
>bits of XML. That is the problem.

Well, I disagree that this is a problem.

Suppose you want to create an XML document with dynamic content. You can 
take an existing XML document and modify it by adding query expressions. 
The original XML document is treated as an element constructor.

> > My assumption has been that queries would be written in Unicode.
>but what does that mean?
>Unicode is a set of characters but what is the encoding used? utf16? utf8?

Yes, this needs to be more precisely specified than it is in the current 
specification.

> > However, perhaps it would make sense to require
> > XQuery processors to also accept queries in an XML document that simply
> > embeds the query in an element:
>
>currently the only safe way to embed Xquery in XML is to stick the whole
>lot in a CDATA section or equivalently quote each <

Actually, I do not think this is true. You can also use XQueryX or computed 
element constructor syntax.

> > How important is it to be able to write queries in any encoding you
> > want?
>
>If you want to get an answer to that question, don't ask an English
>mathematician:-) It was thought crucially important in the design of
>XML. Have you (the Query WG) asked the W3C I18n group to review this issue?

Frankly, we haven't really been discussing encoding issues in any depth to 
date. We should do so, and the I18N should be involved.

> >  I would hope that the XSLT
> > author knows exactly what they are doing when they do that kind of XML
> > quoting,
> >
>In typical situations they don't even know it is happening at all. If
>you write out Xpath's from XSLT (for example) then ultimately it is the
>system not the author that decides what encoding is used and whether any
>particular character will be output as character data or a numeric
>character reference.

But if the author has no idea what the processor will do, the author is up 
a creek. Surely the author needs to understand the meaning of an XPath, or 
get unexpected results.

> >  In XQuery, it
> > is important that element constructors are expressions that have a
> > well-known type, not a black-box way of creating nodes. Element
> > constructors should be present in both the grammar and the type system.
>
>The tokens in the Xquery grammar can be infoset items resulting from a
>preliminary XML parse, as in XSLT. You don't have to specify the grammar
>down to the level of characters, thus duplicating so much of XML.

One of the design goals of XQuery is to be easily parsed using conventional 
tools like lex and yacc or JavaCC.  These have no notion of the XML 
Information Set.

Jonathan

Received on Thursday, 3 January 2002 11:28:14 UTC