Skip to content

Xml: is keep the namespace #1730

@mikefarah

Description

@mikefarah

Discussed in #1721

Originally posted by elandorr July 8, 2023
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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions