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

comments at top of xml is unparsable back to yaml #1563

Closed
gwythaint opened this issue Feb 20, 2023 · 4 comments
Closed

comments at top of xml is unparsable back to yaml #1563

gwythaint opened this issue Feb 20, 2023 · 4 comments
Labels

Comments

@gwythaint
Copy link

comment at top of yaml produced by yq considered invalid by yq

yq --version
yq (https://github.com/mikefarah/yq/) version v4.30.8

sample.xml contents contains an xml comment on the second line below xml version declaration

Screenshot2023_02_19_181858

yq -p=xml sample.xml | yq -o=xml
Error: xml: EncodeToken of ProcInst xml target only valid for xml declaration, first token encoded

@mikefarah
Copy link
Owner

Hmm I see - I'll look into this - although regardless I recommend running the command like so (which does work)

yq -p=xml -o=-xml sample.xml

Also - for next time can you please dump the xml contents in a code block instead of an image - can copy paste text from an image :)

@gwythaint
Copy link
Author

Yes, "yq -p=xml -o=-xml sample.xml" works.. but... ?!?! it's kinda degenerate. I want the the intermediate yaml. Did I fail to detect sarcarsm?

@mikefarah
Copy link
Owner

...it's a workaround till I get free personal time to work on the open-source project...feel free to raise a PR if you would like it sooner

@mikefarah
Copy link
Owner

Fixed in v4.31.2

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

No branches or pull requests

2 participants