Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

296 Allow default-namespace=##any #1181

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

michaelhkay
Copy link
Contributor

Allows the default namespace for elements and types to have the special value "##any", which causes unprefixed QNames to match elements in any namespace. Use cases include:

  • Casual ad-hoc XPath queries, where over-retrieval isn't a problem
  • Use with HTML, where it can be unpredictable whether elements will be in a namespace, and where users are accustomed to browser behaviour with its "wilful violation" of the XPath 1.0 specification
  • Any environment where multiple namespaces are in use for variants of what is essentially the same vocabulary of element names (for example, where the XML designer has made the mistake of versioning the namespace URI)

@michaelhkay
Copy link
Contributor Author

Fix #296

@michaelhkay michaelhkay added XPath An issue related to XPath XQuery An issue related to XQuery XSLT An issue related to XSLT Feature A change that introduces a new feature Tests Needed Tests need to be written or merged labels Apr 30, 2024
Copy link
Contributor

@ChristianGruen ChristianGruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it’s unlikely that ##any is already widely used in our solar system, a note would be helpful that explains the rationale behind this particular string.

At least for XQuery, explicit syntax feels safer to me (to avoid typos such as #any):

(: which, I assume, will return the element :)
declare default element namespace any;
<xml:x/>/self::x

In proprietary interfaces, null, undefined or anything else could be supplied to indicate this special case.

@michaelhkay
Copy link
Contributor Author

Fix #379

@ndw
Copy link
Contributor

ndw commented Jun 5, 2024

The CG agreed to merge this PR at the Prague f2f.

@ndw ndw added the Propose Merge without Discussion Change is editorial or minor label Jun 5, 2024
@ndw
Copy link
Contributor

ndw commented Jun 11, 2024

The CG agreed to merge this PR without further discussion at meeting 81.

@ndw ndw merged commit e23e66d into qt4cg:master Jun 11, 2024
2 checks passed
@michaelhkay michaelhkay deleted the 296-default-namespace-auto branch June 11, 2024 19:25
@michaelhkay michaelhkay removed the Propose Merge without Discussion Change is editorial or minor label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A change that introduces a new feature Tests Needed Tests need to be written or merged XPath An issue related to XPath XQuery An issue related to XQuery XSLT An issue related to XSLT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants