-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
pkgs-lib.formats.xml: init #342633
Merged
+102
−0
Merged
pkgs-lib.formats.xml: init #342633
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would namespaces look?
Does definition merging work as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it follows: https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html:
i found: https://github.com/martinblech/xmltodict/blob/master/README.md#namespace-support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespaces are "mainly problematic" for parsing the other way around. it can be achieved via:
to create:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, makes sense.
Handling foreign input while programming with hardcoded prefixes is basically wrong; an XML document should behave exactly the same under prefix renaming, but a lot of software requires certain prefixes, which is - in principle - wrong.
However, we will have to cater to such applications, and users who are kinda ok with such requirements, so that's just that.
Treating any node as URI + tag instead of prefix + tag makes any XML processing more robust (for an option type, the processing means implementing a
merge
operation for the XML representation), so that may be worth considering, but it seems that we'd end up writing a small library for that purpose; a bit of a research project.So for now I think we only need to point out in the docs that the type deals with the concrete syntax of the XML, and all responsibility is on the user when it comes to the correctness of any use of namespace features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this will not be the "perfect/best" xml-exporter for nix, I would suggest to get started, but name it "specially" (not
xml
as we both agreed above.).Surely there are a lot of things to improve, but in the end we should enable other users to enable new NixOS-options. Migrating this to other formats seems tedious (manual work), but doable.
Documentation is currently missing completely, because I do not know where to put it. Any suggestions where to put it?