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

528bis element to map #1575

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michaelhkay
Copy link
Contributor

@michaelhkay michaelhkay commented Nov 14, 2024

Supersedes #529
Fix #528

Coming back to this after a long gap, I have redrafted the proposal. I've tried to take as many of the comments into account as possible, but I'm aware that I haven't responded to them all.

@michaelhkay michaelhkay added XQFO An issue related to Functions and Operators Feature A change that introduces a new feature Tests Needed Tests need to be written or merged labels Nov 14, 2024
@ChristianGruen
Copy link
Contributor

I would still be interested in feedback on some of the comments I raised in #529 (comment) (it’s been a while ago, though):

  1. Do you think we could drop the [normalize-space()] predicates?
  2. What about merging some of the patterns (simple, simple-plus (extended?), record, mixed, and a custom function)?
  3. (The most difficult one, probably): Could it be an option to define the function for a single node() input, to be able to write fn:xml-to-map(doc('regular.xml')?

@michaelhkay
Copy link
Contributor Author

michaelhkay commented Nov 16, 2024

I did review all the comments on #529 and implemented those that I thought were straightforward, but there are certainly others that are worth discussing.

I felt that the [normalize-space()] predicates were the right way (in the absence of a schema) to distinguish elements with element-only content from elements with mixed content. You really want to discard whitespace text nodes in the conversion if it's element-only content, and not otherwise.

I looked at merging some of the layouts but I felt that there were signifcant distinctions, and you want to give users this level of fine control.

I agree it would be convenient for users to allow the input to be a document node rather than an element, but I wasn't sure what to say if the document node doesn't have a single element child.

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 XQFO An issue related to Functions and Operators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fn:elements-to-maps (before: Review of the fn:json() function)
2 participants