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

add xml support as xq (from python yq) #215

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Conversation

momiji
Copy link

@momiji momiji commented Jun 6, 2023

The idea it to add xml support the same as xq (installed with python yq).
It supports multiple xml inputs, that xq does not allow.

On read, much faster than original xq.
On write, many times faster than json2xml.

I'm opened to ideas.

@momiji
Copy link
Author

momiji commented Jun 7, 2023

hello, I'm still doing havy tests on our servers, I let you know when it is ready for publishing

@@ -61,13 +71,22 @@ type flagopts struct {
OutputCompact bool `short:"c" long:"compact-output" description:"output without pretty-printing"`
OutputIndent *int `long:"indent" description:"number of spaces for indentation"`
OutputTab bool `long:"tab" description:"use tabs for indentation"`
OutputYAML bool `long:"yaml-output" description:"output in YAML format"`
OutputYAML bool `short:"y" long:"yaml-output" description:"output in YAML format"`
OutputXML bool `short:"x" long:"xml-output" description:"output in XML format"`
Copy link

Choose a reason for hiding this comment

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

(Note: I'm not the author of gojq, just an interested third party.)

I think it makes sense to add even more formats in the future (toml, msgpack, bson, etc), but this list of boolean flags will grow unmanageable.

What do you think about --input-format=xml and --output-format=xml instead of these format-specific parameters?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, looks to be a very good idea :)

@momiji
Copy link
Author

momiji commented Aug 7, 2023

If anyone is interested, a binary built called "xjq" is available here; https://github.com/momiji/xjq.
It is build using the updated forked gojq code, which is near up-to-date: momiji/gojq@main...itchyny:gojq:main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants