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

Add FromXmlParser.Feature.RETAIN_ROOT_ELEMENT to allow lossless round-trip via Tree Model #484

Open
cowtowncoder opened this issue Jul 8, 2021 · 4 comments
Labels
pr-needed Feature request for which PR likely needed (no active development but idea is workable)

Comments

@cowtowncoder
Copy link
Member

Normally XML document like:

<root>
  <value>3</value>
</root>

would be exposed as equivalent to JSON

{ "value" : "3" }

since that is typically the straight-forward and suitable representation for databinding use.

But when reading "as a tree", into JsonNode, this will lose a small part of information, namely the name of root element.
User has no way to access this information, and although technically we could store it for access, API would feel clunky.

So instead perhaps there should be an option to instead expose said document like so:

{
  "root" : {
     "value" : "3"
  }
}

This would be particularly useful when coupled with the recently added ToXmlGenerator.Feature.UNWRAP_ROOT_OBJECT_NODE (added via #441) as users could then get full round-tripping of XML documents.

Note: one potential problem we do have is the "too late" passing of format-feature flags -- it would be particularly gnarly problem here.

@asharani-m
Copy link

asharani-m commented Dec 10, 2021

Hi @cowtowncoder do not see this issue fixed in 2.13. Any plans in coming releases?

@cowtowncoder
Copy link
Member Author

cowtowncoder commented Dec 11, 2021

@asharani-m We would need someone to tackle this, i.e. PRs most welcome.

Since it requires API addition, needs to go in 2.14.

@cowtowncoder cowtowncoder added 2.14 and removed 2.13 labels Dec 11, 2021
@cowtowncoder cowtowncoder removed the 2.14 label Nov 17, 2023
@ViliusS
Copy link

ViliusS commented Jan 11, 2024

Is someone still working on this issue?

@cowtowncoder cowtowncoder added the pr-needed Feature request for which PR likely needed (no active development but idea is workable) label Jan 12, 2024
@cowtowncoder
Copy link
Member Author

@ViliusS I don't see any suggestion that anyone was working on this issue. So most likely would require someone to step up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-needed Feature request for which PR likely needed (no active development but idea is workable)
Projects
None yet
Development

No branches or pull requests

3 participants