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

xml.decode: flat mode #727

Open
Sainan opened this issue Mar 3, 2024 · 0 comments
Open

xml.decode: flat mode #727

Sainan opened this issue Mar 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Sainan
Copy link
Member

Sainan commented Mar 3, 2024

The way xml.decode currently behaves is more akin to a "full" mode. It would be good to also add a "flat" mode to it, but it needs to also consider the same tag being present multiple times:

<entries>
    <entry primary="">
        <name>primary</name>
    </entry>
    <entry/>
</entries>
{
    ["entries"] = {
        ["entry"] = {
            [1] = {
                ["__attributes"] = {
                    ["primary"] = string(0) "",
                },
                ["name"] = string(7) "primary",
            },
            [2] = {},
        },
    },
}

Of course, it would mean that only 1 entry would be flattened like this:

<entries>
    <entry primary="">
        <name>primary</name>
    </entry>
</entries>
{
    ["entries"] = {
        ["entry"] = {
            ["__attributes"] = {
                ["primary"] = string(0) "",
            },
            ["name"] = string(7) "primary",
        },
    },
}

Maybe adding an option to pick how "aggressive" the flattening should be could also help here.

@Sainan Sainan added the improvement Improves existing behavior label Mar 3, 2024
@Sainan Sainan added this to the 0.9.0 milestone Mar 3, 2024
@Sainan Sainan changed the title XML: Simple Mode XML: Flat Mode Mar 4, 2024
@Sainan Sainan added enhancement New feature or request and removed improvement Improves existing behavior labels Mar 4, 2024
@Sainan Sainan removed this from the 0.9.0 milestone Mar 4, 2024
@Sainan Sainan changed the title XML: Flat Mode xml.decode: flat mode Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant