Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Arrangement of children not preserved #45

Description

@roniemartinez

How do you preserve the arrangement of children with same name?

XML To JSON:
Code:

dumps(badgerfish.data(eTree.fromstring('<alice><david>edgar</david><bob>charlie</bob><david>edgar</david></alice>')))

Output:

{"alice": {"david": [{"$": "edgar"}, {"$": "edgar"}], "bob": {"$": "charlie"}}}

Back to XML:
Code:

eTree.tostring(badgerfish.etree(loads({"alice": {"david": [{"$": "edgar"}, {"$": "edgar"}], "bob": {"$": "charlie"}}}))[0]).decode('utf-8')

Output:

<alice><david>edgar</david><david>edgar</david><bob>charlie</bob></alice>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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