W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2007

[Bug 5083] Namespace declaration attributes in direct element constructors

From: <bugzilla@wiggum.w3.org>
Date: Wed, 26 Sep 2007 20:53:35 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1Iadt1-0007DV-HK@wiggum.w3.org>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5083

           Summary: Namespace declaration attributes in direct element
                    constructors
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


Consider the query

<a xmlns="a-strange-uri{1,2}"/>

I think this is legal, and it places element a in the namespace
"a-strange-uri{1,2}".

Now consider the query

<a xmlns="a-strange-uri{1,-}"/>

I think this is not legal, on the curious grounds that '1,-' is not a valid
XPath expression.

Although the text in 3.4.1.2 says "The value of a namespace declaration
attribute must be a URILiteral;" (where one has to assume that "value" means
the thing after the = sign including the delimiting quotes), the grammar treats
the value as a DirAttributeValue. So we must assume that it must be both a
URILiteral and a DirAttributeValue, and this requires that anything between
curly braces is a valid XPath expression, even though it will never be
evaluated as an XPath expression. This can give rise to some surprising error
messages.

To make matters even worse, it seems that the prefix actually being declared is
in-scope within all these spurious XPath expressions, thus:

<a xmlns:b="zzz{a:xyz}" xmlns:a="zzz{b:xyz}"/>

is legal only because the prefixes used within the curly braces are both in
scope.

Although it's not nice to change the grammar at this stage of the game, I feel
the only clean solution is to remove the requirement that the value of a
namespace declaration attribute should be a DirAttributeValue. The grammar
would thus become something like:

DirAttributeList ::= (Attribute | Namespace)* 

Attribute ::= S QName S? "=" S? DirAttributeValue /* where QName is suitably
restricted */

Namespace ::= S QName S? "=" S? UriLiteral /* where QName is suitably
restricted */
Received on Wednesday, 26 September 2007 20:53:45 GMT

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