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

At 03:11 PM 1/3/2002 -0500, Elliotte Rusty Harold wrote:
>For me yes, but that's not the point. We are asking you to get rid of the 
>pseudo-XML syntax. We are not asking you to add a new syntax. If you 
>deleted the pseudo-XML syntax and relied completely on the computed 
>element constructor syntax then I'd be happy.

The computed element constructor syntax already exists, and would not need 
to be added. I agree that ditching the XML constructor syntax would not 
delay XQuery at all - it would also make it easier to parse.

However, I think that a lot of people like the XML constructor syntax, 
because if you want to construct XML, you can simply type in the equivalent 
XML text, or copy it from an existing document.

>Not to mention this would make the specs smaller, easier to understand, 
>easier to learn, and easier to implement. I don't see the point here of 
>two completely equivalent ways to accomplish exactly the same thing, 
>especially when one of those ways is guaranteed to confuse users and 
>developers.

The reason for computed element constructor syntax was originally to allow 
the names of elements and attributes to be constructed at run-time. We 
added this after the XML constructor syntax was already in place. For 
instance, given a variable $b that contains the name of an element, you can 
create an element like this:

         element { $b }
         {
                 attribute id { "id102" },
                 "This is the text of the element"
         }

If we know the name of the element in advance, we can use either of the 
following syntaxes:

         element foo
         {
                 attribute id { "id102" },
                 "This is the text of the element"
         }

or

         <foo id="id102">This is the text of the element</foo>

I think that using XML syntax is intuitive to people who know XML. And 
although not all of XML is supported, the XQuery element constructors 
really do construct the same thing as the equivalent XML text would 
construct, except that (1) curly braces { } escape to native XQuery synta, 
and (2) some things like entities (other than predefined character 
references) and encodings are not supported.

That said, if our various communities would say loudly to us that we should 
drop the XML syntax, I would not have particularly strong objections to that.

Jonathan

Received on Thursday, 3 January 2002 16:15:05 UTC