W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2014

[Bug 27416] New: [XP31] Special characters in names

From: <bugzilla@jessica.w3.org>
Date: Mon, 24 Nov 2014 13:15:08 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-27416-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27416

            Bug ID: 27416
           Summary: [XP31] Special characters in names
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath 3.1
          Assignee: jonathan.robie@gmail.com
          Reporter: mike@saxonica.com
        QA Contact: public-qt-comments@w3.org

XPath is often used to access HTML documents rather than XML documents. HTML5
names allows characters that are not allowed in XML names (for example, '$' is
allowed in attribute names, and attribute names can start with a digit). At
present the only way to reference such attributes is with the circumlocution
*[local-name()='$name'] (and even this requires a violation of contraints in
the XDM specification). 

It would be useful to have a defined way to perform queries on XDM instances
that aren't constrained by the XML rules on valid element and attribute names.
This would also make it easier to map other data models to XDM.

I would therefore propose that

(a) XDM should allow, perhaps in some kind of "non-XML mode", arbitrary strings
to appear as element and attribute (local) names

(b) XPath should have some kind of escape mechanism to allow searching for such
names. One possibility would be enclosing the string in backticks, e.g. 

@`$name`

Another would be to allow character references to be used in names (which of
course would need to be double-escaped when XPath is embedded in XML):

@&#36;name

Another would be to adapt the EQName syntax: N{$name}.

There are other situations where escaped names would be useful: for example
calling out to functions in a different programming language, or referencing
JSON keys.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Monday, 24 November 2014 13:15:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:59 UTC