kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.53k stars 81 forks source link

xml: is keeping the namespace possible? #169

Closed elandorr closed 1 year ago

elandorr commented 1 year ago

Hi

is it possible to keep the ns here?

<?xml version="1.0" encoding="UTF-8"?>
<foo>
    <title>barfoo</title>
    <macroni:title>foobar</macroni:title>
</foo>

The macroni is lost.

+p_xml: version="1.0" encoding="UTF-8"
foo:
  title:
    - barfoo
    - foobar

I have a file that uses such a format, which means this borks:

yq -pxml -oy '.foo.title' fooo.xml 

- barfoo
- foobar

Ideally it would only show the <title>.

Appreciate yq, really useful, thanks!

elandorr commented 1 year ago

Sorry, that's the wrong repo. Same name. This might just apply to you as well, though :)