W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2005

Re: Optional indicator in direct element and attribute constructors.

From: <scott_boag@us.ibm.com>
Date: Fri, 13 May 2005 14:24:10 -0400
To: "Daniel Engovatov" <dengovatov@bea.com>
Cc: public-qt-comments@w3.org
Message-ID: <OFD816350A.35505E05-ON85257000.0063BA08-85257000.006516BF@lotus.com>

Hi Daniel.  One problem with your proposal is that we've tried had to make 
the direct constructors as compatible with XML as possible.  This becomes 
especially important with proposals that declare a midweight syntax for 
XQuery that is XML, and where these direct contructors become XML syntax. 
I also do know of XQuery parsers that are taking advantage of a sub-XML 
parser.  At the very least, this seems like a pretty disruptive change at 
this point... we'd all like to get XQuery finished, and in the hands of 
users.

So I'm wondering if an alternative might be to add a prolog declaration 
that has a list of QNames,  and which say which empty elements and 
attributes would not be output.  In terms of addressing your use cases, is 
this idea worth developing?  (Just brainstorming...)

-scott




"Daniel Engovatov" <dengovatov@bea.com> 
Sent by: public-qt-comments-request@w3.org
05/12/2005 09:51 PM

To
<public-qt-comments@w3.org>
cc

Subject
Optional indicator in direct element and attribute constructors.







This is an enhancement proposal based upon a very frequently encountered
problem among users of our implementation: an external consumer of XML
generated by XQuery does want to have certain empty elements and
attributes to be omitted. 

For example: 
for a query 
<a><b>{()}</b><c foo="{()}"/></a>, 

instead of returning 
<a><b/><c foo=""/></a>

to return 
<a><c/></a>

Producing this result using computed constructors, conditional
statements and custom functions turns out to be quite inelegant,
cumbersome and hard to maintain.

Proposed extension is to add "optional" indicators, using '?' character
("?"?) to the direct element and attribute constructors:

Change production DirElemConstructor to

[94]    DirElemConstructor    ::=    "<" QName "?"? DirAttributeList
("/>" | (">" DirElemContent* "</" QName S? ">")) /* ws: explicit */ 
 

And for 
[95]    DirAttributeList    ::=    (S (QName "?"? S? "=" S?
DirAttributeValue)?)*

When '?' is present, elements with no children should be omitted, and
attributes with value "" should be omitted.

Query in the example would be written

<a><b?>{()}</b><c foo?="{()}"/></a>

To produce <a><c/></a>

Daniel;
Received on Friday, 13 May 2005 18:24:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:38 GMT